双向绑定
12345678910111213141516171819// 发布订阅class pubSub { constructor() { this.events = {}; } publish(event, ...args) { this.events[event].forEach(cb => cb(...args))
12345678910111213141516171819// 发布订阅class pubSub { constructor() { this.events = {}; } publish(event, ...args) { this.events[event].forEach(cb => cb(...args))