Skip to content

Supine1997/wechat-eventBus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

wechat-eventBus

这是一个关于小程序事件订阅的npm包
引入js
import EventBus from '@eventBus/eventBusjs';
引入ts
import EventBus from '@eventBus/eventBusts';

使用方法
---PageA---
page({
 onLoad(){
  EventBus.on('eventName',this,(msg)=>{
   console.log(msg);
  })
},
 onUnload(){
  EventBus.remove('eventName',this);
 }
})

---PageB---
page({
 onLoad(){
  EventBus.send('eventName','Hello this is PageB')
 },
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published