1.在看vue源码相关的帖子中看到这个函数:class Dep () { constructor () { this.subs = []; } addSub (sub: Watcher) { this.subs.push(sub) } removeSub (sub: Watcher) { remove(this.subs, sub) } notify () { // stabilize the subscriber list first const subs = this.subs.slice() for (let i = 0, l = subs.length; i < l; i++) { subs[i].update() } }}这里的Watcher也是一个class对象,那么这里的(sub: Watcher)是一个键值对?那不是应该要有中括号吗?还是我理解岔了?
添加回答
举报
0/150
提交
取消