1.使用PubSubJS

  1. 1. 工具库: PubSubJS
  2. 2. 下载: npm install pubsub-js --save
  3. 3. 使用:
  4. 1) import PubSub from 'pubsub-js' //引入
  5. 2) PubSub.subscribe('delete', function(msg,data){ }); //订阅
  6. 3) PubSub.publish('delete', data) //发布消息