摘要: 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 阅读(91) 评论(0) 推荐(0)
摘要: 为深度嵌套的组件,父组件provide提供数据来源,子组件inject开始使用这个数据 provide: { todoLength: this.todos.length // 将会导致错误 'Cannot read property 'length' of undefined` }, //要访问组件 阅读全文
posted @ 2021-02-25 16:18 6NULL9 阅读(916) 评论(0) 推荐(0)
摘要: 1.实现单例模式: 保证一个类仅有一个实例,并提供一个访问它的全局访问点 var Singleton = function( name ){ this.name = name; this.instance = null; }; Singleton.prototype.getName = functi 阅读全文
posted @ 2021-02-25 16:12 6NULL9 阅读(82) 评论(0) 推荐(0)
摘要: 函数就是对象,对象字面量产生的对象连接到Object.prototype,函数对象连接到Function.prototype,每个函数还接收两个附加的参数:this(依不同调用模式指向不同)和arguments函数调用共4种调用模式:方法调用模式,函数调用模式,构造器调用模式和apply调用模式 方 阅读全文
posted @ 2021-02-25 16:09 6NULL9 阅读(65) 评论(0) 推荐(0)