weex下的返回上一页以及页面跳转

1. weex下返回上一页:使用weex-vue-navigator插件。参考:https://github.com/MMF-FE/weex-vue-navigator。
    1.1 下载:npm i weex-vue-navigator --save-dev。
    1.2 在entry.js文件中配置引入:

const { router } = require('./router');
const App = require('@/index.vue');
import weexNavigator from 'weex-vue-navigator'
Vue.use(weexNavigator, {router})
new Vue(Vue.util.extend({el: '#root', router}, App));
router.push('/');
weexNavigator.bootstrap()

    1.3 在.vue文件中使用:
        this.$goTo(url)    //跳转指定页面。这个url是router里面配置的路由,如"/login",并自带动画效果。
        this.$back()  //返回上一页
        this.$goTo(url, true)

猜你喜欢

转载自blog.csdn.net/qq_42231156/article/details/86629115