uileader / touchui

高质量移动端UI框架。官网:https://www.wetouch.net
1.39k stars 174 forks source link

这个怎么解决 #15

Closed QTTQ closed 6 years ago

QTTQ commented 6 years ago

![Uploading image.png…]() ![Uploading image.png…]()

QTTQ commented 6 years ago

结果触发这个navHandle方法却弹出错误这个Bus.fire在正常得vue里是正常方法 这结果却显示 Uncaught TypeError: Bus.fire is not a function

pangxiaodun commented 6 years ago

`mounted () { var script = document.createElement("script") script.type = "text/javascript" script.src="https://cdn.bootcss.com/onfire.js/1.0.6/onfire.js" document.body.appendChild(script)

script.onload = function(){
    console.log(onfire,'1111111342ef')
    function test_callback(data1, data2) {
      console.log('this is a event 1');
    }

    // 绑定事件
    var eventObj = onfire.on('test_event', test_callback);
    var eventObj2 = onfire.on('test_event', function(data1, data2) {
      console.log('this is a event 2');
    });

    // 触发事件
    onfire.fire('test_event', 'test_data1', 'test_data2');

    // 取消绑定
    onfire.un(eventObj); // 取消绑定这个事件.
    onfire.un('test_event'); // 取消绑定所有的 `test_event`.
    onfire.un(test_callback); // 取消绑定所有的 `test_callback` 方法.
}

}`

QTTQ commented 6 years ago

哦哦 谢谢