1.0.23 • Published 6 years ago

wx-event-handler v1.0.23

Weekly downloads
5
License
ISC
Repository
-
Last release
6 years ago

WxEventHandler

Make you feel like use Vue's event controler, just support in single page init your single instance.

example code

demo

  const WxEventHandler = require('wx-event-handler').default;

  //实例化一个事件控制器
  const myEventHandler = new WxEventHandler("MyPageName");

  Page({
    sayHello(hello, name){
      wx.showModal({
        title: hello,
        content:name
      });
    },
    onLoad(){
      //监听
      myEventHandler.on("sayHelloTo", this.sayHelloTo);
    },
    onUnload(){
      //取消监听
      myEventHandler.off("sayHelloTo");
    },
    onClick(){
      //发射事件
      myEventHandler.emit("sayHelloTo", "Hello", "Peter Yuan");
    }
  }
1.0.23

6 years ago

1.0.22

6 years ago

1.0.21

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago