02 2021 档案

摘要:1.使用一个临时的函数名存储函数 2.重新定义原来的函数 3.定义扩展的功能 4.调用临时的那个函数 function func() { console.log("原始的功能") } let _tmpFn = func; func = function () { _tmpFn(); console. 阅读全文
posted @ 2021-02-28 18:24 6NULL9 阅读(155) 评论(0) 推荐(0) 编辑
摘要:vue中是如何监听数组变化? 我们知道通过Object.defineProperty()劫持数组为其设置getter和setter后,调用的数组的push、splice、pop等方法改变数组元素时并不会触发数组的setter,这就会造成使用上述方法改变数组后,页面上并不能及时体现这些变化,也就是数组 阅读全文
posted @ 2021-02-28 17:54 6NULL9 阅读(2021) 评论(0) 推荐(0) 编辑
摘要:(.+)默认是贪婪匹配 (.+?)为惰性匹配 疑问号让.+的搜索模式从贪婪模式变成惰性模式。 var str = 'aaa<div style="font-color:red;">123456</div>bbb' <.+?>会匹配<div style="font-color:red;"> <.+>会 阅读全文
posted @ 2021-02-27 13:38 6NULL9 阅读(356) 评论(0) 推荐(0) 编辑
摘要:借用原型链 通过prototype属性 function SuperType() { this.superType = 'SuperType'; } SuperType.prototype.getSuper = function() { return this.superType; } functi 阅读全文
posted @ 2021-02-26 16:24 6NULL9 阅读(44) 评论(0) 推荐(0) 编辑
摘要:console.log(1) setTimeout(() => console.log(2), 0) new Promise((resolve, reject) => { console.log(3) resolve() }).then(() => { console.log(4) }) // 1 阅读全文
posted @ 2021-02-25 16:30 6NULL9 阅读(82) 评论(0) 推荐(0) 编辑
摘要:为深度嵌套的组件,父组件provide提供数据来源,子组件inject开始使用这个数据 provide: { todoLength: this.todos.length // 将会导致错误 'Cannot read property 'length' of undefined` }, //要访问组件 阅读全文
posted @ 2021-02-25 16:18 6NULL9 阅读(906) 评论(0) 推荐(0) 编辑
摘要:1.实现单例模式: 保证一个类仅有一个实例,并提供一个访问它的全局访问点 var Singleton = function( name ){ this.name = name; this.instance = null; }; Singleton.prototype.getName = functi 阅读全文
posted @ 2021-02-25 16:12 6NULL9 阅读(75) 评论(0) 推荐(0) 编辑
摘要:函数就是对象,对象字面量产生的对象连接到Object.prototype,函数对象连接到Function.prototype,每个函数还接收两个附加的参数:this(依不同调用模式指向不同)和arguments函数调用共4种调用模式:方法调用模式,函数调用模式,构造器调用模式和apply调用模式 方 阅读全文
posted @ 2021-02-25 16:09 6NULL9 阅读(62) 评论(0) 推荐(0) 编辑
摘要:window.matchMedia(mediaQueryString) mediaQueryString: 必需,一个字符串,表示即将返回一个新 MediaQueryList 对象的媒体查询 min-height, min-width, orientation等。 function myFuncti 阅读全文
posted @ 2021-02-24 21:23 6NULL9 阅读(64) 评论(0) 推荐(0) 编辑
摘要:/** * @param {String} message 错误信息 * @param {String} source 出错文件 * @param {Number} lineno 行号 * @param {Number} colno 列号 * @param {Object} error Error对 阅读全文
posted @ 2021-02-24 16:38 6NULL9 阅读(52) 评论(0) 推荐(0) 编辑
摘要:xpath选择器 表达式说明 article 选取所有article元素的所有子节点 /article 选取根元素article article/a 选取所有属于article的子元素的a元素 //div 选取所有div子元素(不论出现在文档任何地方) article//div 选取所有属于arti 阅读全文
posted @ 2021-02-22 21:41 6NULL9 阅读(154) 评论(0) 推荐(0) 编辑
摘要:<ul class="list"> <li>123</li> <li>abc</li> </ul> #1 xx.xpath("./ul[@class='list']/li") #xx是html文档 #xpath解析返回一个解析器列表 #2 xx.xpath("./ul[@class='list']/ 阅读全文
posted @ 2021-02-22 21:28 6NULL9 阅读(476) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示