1.0.23 • Published 7 years ago

wx-event-handler v1.0.23

Weekly downloads
5
License
ISC
Repository
-
Last release
7 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

7 years ago

1.0.22

7 years ago

1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago