weex icon indicating copy to clipboard operation
weex copied to clipboard

native端怎么调用Weex中的方法呢?

Open voidxin opened this issue 10 years ago • 1 comments

iOS端,我知道可以使用callback从native往weex页面传数据或调用方法,但之前这个动作是在weex页面中触发的,比如点击weex页面中的某个按钮,然后去实现譬如checkUpdate这样的代码:

        checkUpdate : function(){
         var self = this;
         var eventModule = require('@weex-module/event'); 
         eventModule.checkVerionWithLocalVersion(function(ret) { 
             self.version = ret;
             self.loadVersionData(ret);
             
           });
      },

现在我想知道是怎么直接在native中调用weex中的方法或者传数据过去呢?比如我有一个button是native的,我点击button的时候需要主动的调用weex页面中的某个function方法并传递native中获取到的数据(比如点击后直接调用weex页面中诸如上面的checkUpdate方法)。请问我该怎么做。

voidxin avatar Nov 18 '16 01:11 voidxin

ok,我发现0.8中已经有文档介绍了doc,解决了,谢谢

voidxin avatar Nov 18 '16 02:11 voidxin