分类:脚本语言
共 349 篇
先看两个例子: 运行结果一样的,粗看没什么区别,我们试着修改下name属性值,会发现computed的修改会出错,这是因为computed里的属性默认只有getter,也就是只读的,不能赋值: 如果要赋值,还需给它要加上setter: OK,这样就和data一样了,可以看到,computed可以更精细的控制属性读写,但它需要借助一个临时变量(temp_name)才能实现,这样跟C#的字段和属性差不多意思了。当然了,官方称computed为计算属性,computed更大的意义在于计算,再看个例子:
👤 博主
📅 2022-03-21
📂 脚本语言
👁 2853
👍 0
🔄 来源:本站原创
阅读全文 →
Vue (读音 /vjuː/,类似于 view) 是一套用于构建用户界面的渐进式框架。与其它大型框架不同的是,Vue 被设计为可以自底向上逐层应用。Vue 的核心库只关注视图层,不仅易于上手,还便于与第三方库或既有项目整合。 一、引入Vue 二、Vue实例创建 Vue实例属性其实有两类,为了便于称呼,我想了两个名称:固有属性和用户属性,举个例子说明: el和data是Vue实例固有的属性,需在名称前加$才能访问它们,例如vm.$el,vm.$data,我称为固有属性;name是用户添加的属性,可直接访问,例如vm.name,我称为用户属性。Vue实例方法也是一样的,有固有方法和用户方法,下边我都这么称呼它们。更多Vue实例属性和方法详见《Vue API文档》。…
👤 博主
📅 2022-03-20
📂 脚本语言
👁 2507
👍 0
🔄 来源:本站原创
阅读全文 →
Mozilla开发者社区(MDN)对void的定义如下: void是一个运算符,它对给定的表达式进行求值,然后返回undefined。 即void(0)=undefined,我们知道return;=return undefined;,那么就有: return; = return undefined; = return void(0);
👤 博主
📅 2022-02-04
📂 脚本语言
👁 2769
👍 0
🔄 来源:本站原创
阅读全文 →
所有对 layui 为之热爱、鞭策、奉献,和支持过的开发者: 请接受我用意念和字节传达的深深歉意。这是一个无力、无奈,甚至无助的决定: layui 官网将于 2021年10月13日 进行下线。 届时,包括新版下载、文档和示例在内的所有框架日常维护工作,将全部迁移到 Github 和 Gitee。 此后,layui 仍会在代码托管平台所活跃,且 2.7 正式版也将在其间首发。而 layui 官网将不复存在。 这不是终结,只是重归到开源的纯粹中来。 再者,对于 layuiAdmin 和 layim 的两个特殊专区,将会迁移到新站进行保留,以便老用户还能下载使用。 过去五年,layui 有幸被应用在不计其数的 Web 平台,在前端工程化迅速席来的浪潮中,我们仍然感受到一丝来自于 jQuery 的余晖,这是一种带有热量的冰冷(反之亦可)。使命已达,便纵有万般遗憾,更与何人说?!…
👤 博主
📅 2021-10-12
📂 脚本语言
👁 3470
👍 0
🔄 来源:Layui
阅读全文 →
clipboard.js不依赖flash,不依赖其他框架,gzip压缩后只有3kb大小。 一、引用clipboard.js 二、clipboard.js使用示例 1、从另一个元素复制文本: 或: 2、从属性复制文本: 或: 如果data-clipboard-text的值是动态赋值且比较耗时,可能导致复制的结果不正确,下边是我想到的一种解决方案: 3、监听success和error事件反馈复制结果: 参考资料 .clipboard.js中文网:http://www.clipboardjs.cn/
👤 博主
📅 2020-04-22
📂 脚本语言
👁 3666
👍 0
🔄 来源:本站原创
阅读全文 →
先在页面引入Hanzi Writer脚本: 1、静态输出汉字 加载本地汉字数据(下同): 2、动态书写汉字 3、书写汉字笔画笔顺 相关资源 .hanziwriter.org:https://hanziwriter.org/ .hanzi-writer:https://github.com/chanind/hanzi-writer .hanzi-writer-data:https://github.com/chanind/hanzi-writer-data .makemeahanzi:https://github.com/skishore/makemeahanzi
👤 博主
📅 2020-03-30
📂 脚本语言
👁 8756
👍 0
🔄 来源:本站原创
阅读全文 →
使用Chrome控制台调试页面时,如果页面没有使用jQuery调试起来不方便,我们可以在控制台给页面动态引入jQuery方便调试:
👤 博主
📅 2020-03-18
📂 脚本语言
👁 5008
👍 0
🔄 来源:本站原创
阅读全文 →
在Javascript严格模式下,有的操作是不被允许的,例如使用未声明的变量、删除变量或对象、对只读属性赋值等等,这些规定使编程更加严谨。严格模式在 Javascript 1.8.5 (ECMAScript5) 中新增,使用起来非常简单,只需要在脚本或函数的开头加个use strict指令即可,脚本运行时解释器会严格检查程序是否规范。use strict不是一条语句,它只是一个字面量表达式,在 Javascript 旧版本中会被忽略。 支持严格模式的浏览器:Internet Explorer 10 +、 Firefox 4+ Chrome 13+、 Safari 5.1+、 Opera 12+。 Javascript严格模式使用示例…
👤 博主
📅 2020-02-26
📂 脚本语言
👁 3415
👍 0
🔄 来源:本站原创
阅读全文 →
我们先定义一个用于演示的json对象数组: 当属性值是数字时排序: 当属性值是字符串时排序: 参考资料 .JS字符串比较大小:http://c.biancheng.net/view/5594.html .js 中 json对象数组按对象属性排序:https://blog.csdn.net/u011019468/article/details/89931940
👤 博主
📅 2020-02-02
📂 脚本语言
👁 2832
👍 0
🔄 来源:本站原创
阅读全文 →
Earlier this week the jQuery CDN had an issue that made the jquery-latest.js and jquery-latest.min.js files unavailable for a few hours in some geographical areas. (This wasn’t a problem with the CDN itself, but with the repository that provides files for the CDN.) While we always hope to have 100% uptime, this particular outage emphasized the number of production sites following the antipattern of using this file. So let’s be clear: Don’t use jquery-latest.js on a production site. We know that jquery-latest.js is abused because of the CDN statistics showing it’s the most popular file. That wouldn’t be the case if it was only being used by developers to make a local copy. The jquery-latest.js and jquery-latest.min.js files were meant to provide a simple way to download the latest released version of jQuery core. Instead, some developers include this version directly in their production sites, exposing users to the risk of a broken site each time a new version of jQuery is released. The team tries to minimize those risks, of course, but the jQuery ecosystem is so large that we can’t possibly check it all before making a new release. To mitigate the risk of “breaking the web”, the jQuery team decided back in 2013 that jquery-latest.js could not be upgraded to the 2.0 branch even though that is technically the latest version. There would just be too many sites that would mysteriously stop working with older versions of Internet Explorer, and many of those sites may not be maintained today.…
👤 博主
📅 2019-11-25
📂 脚本语言
👁 25045
👍 0
🔄 来源:jQuery Blog
阅读全文 →