在weex页面中通过 navigator.push的方式跳转页面,而在android端是通过startActivity方法隐式跳转页面;所有展示weex页面的activity的intent-filter中都得有如下配置
<action android:name="com.taobao.android.intent.action.WEEX" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="com.taobao.android.intent.category.WEEX" />
<action android:name="android.intent.action.VIEW" />
而真正区分是目标activity的是data标签
<data android:scheme="http" android:host="192.168.2.31" android:path="/dist/modules/mymessage.js"/>
那么问题来了是不是我有多少个navigator.push,android端就得有多少个activity?怎样来实现activity复用?
比如 push 的uri地址分别为
http ://192.168.2.31:8080/dist/modules/1
http ://192.168.2.31:8080/dist/modules/2
安照前面的思路 android就得注册两个activity,还有这个最大的缺陷就是你必须提前知道uri参数,如果是weex页面从服务器后台拿的;android就无能为力了。该怎么避免这种情况 ,各位大神请不吝赐教
You can refer to the implementation ideas of this project
https://github.com/hanliuxin5...
Maybe there is something wrong with your understanding. The loaded page should be the same one every time it is opened.
Activity
,用默认的navigator
跳转,都是加载category
为com.taobao.android.intent.category.WEEX
的Activity
。所以你只注册这一个Activity
That’s fine. Of course, if there is special processing, you can define your own navigation module and then handle it accordingly.