weex中 navigator跳转:想要实现index跳转到details页面,有没有什么好办法?

1.weex自带的navigator 跳转页面,我看到只能使用全路径进行跳转
2.目前 我有两个页面,index.vue,details.vue 想要实现index跳转到details页面,有没有什么好办法?能否使用路由或者相对路径进行跳转。

阅读 14.6k
7 个回答
引入module
const navigator = weex.requireModule('navigator');

具体实现代码
this.baseURL = 'file://assets/views/details.js';
var params = {
  'url':  this.baseURL,
  'animated' : 'true',
}
navigator.push(params,function(){
});

@李姓的菜 为什么我在运行时会报错 No Activity found to handle Intent

var bundleUrl = this.$getConfig().bundleUrl;
var baseURL = getBaseUrl(bundleUrl);//此方法是从bundleUrl中截取index.vue的路径,具体方法就看你bundleUrl是怎么样的,你自己写个js函数就是了。
var params = {

url:baseUrl + 'details.js',
animated:'true'

};
navigator.push(params,function(e) {
console.log('');
});

可以传文件名称,封装方法自己追加根URL。
或者说,如果你的vue是单页面的话,可以使用vue-router。

有没办法可以在navigator.push之前加载一个loding 的菊花?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进