Weex 导航到选中 tabbar item 扩展方法

android平台 weex sdk 0.10.0

tabbar是在 instanceId =1 
在当前实例很简单,在其他 instance时候,如何切回 tabbar的某一项,没有对应方法。

看文档,我的思路是 BroadcastChannel在不同实例通讯完成

const broadCastChannel = new BroadcastChannel('tab');    
        //bind message handler
    broadCastChannel.onmessage = function (event) {  
        console.log(event.data);
    }

其他实例 调用下面方法 postMessage

var tabChannel;function tab(url){
    tabChannel = new BroadcastChannel('tab');
    tabChannel.postMessage(url);
    tabChannel.close();
    tabChannel = null;
}

真机运行,以为可以解决了,实际运行 BroadcastChannel is not defined,那就是 js框架不支持
BroadcastChannel ,不知道怎么弄了,有朋友有解决方法吗?在其他实例,切回 tabbar的某一项,

思路2:
js getInstance 获取到 instanceId=1 这个实例,不知道这个思路是否可行,js 有无 getInstace 方法


慕田峪9158850
浏览 851回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP