weex vue 路由 .vue页面间跳转。用ios的weex playground测试,发现按钮根本点击不了,也跳转不了

按照这位大神的代码:
http://www.jianshu.com/p/4025...
做了一个简单的路由跳转。我用ios的playground来测试,发现点击按钮并没有任何反应,同时也跳转不了。

<!-- foo.vue -->
<template>
     <div class="wrapper">
          <router-view></router-view>
      </div>
</template>

<!-- home.vue -->

<template>
    <div>
        <text class="button" @click="jump('messages')"> 跳转至messages页面 </text>
    </div>
</template>

<script>
      export default {
           methods:{
             /*
                jump:function (e) {
                        this.$router.push(e);
                 }
                 */
                 jump:function (e) {
                        this.$router.push(e);
                 }
            }
     }
</script>
<!-- messages.vue -->
<template>
    <div>
        <text class="button" @click="goback()">返回</text>
        <text>messages页面</text>
     </div>
</template>
<script>

export default{
    methods:{
        goback:function(){
             this.$router.go(-1)
         }
    }
}

</script>
<!-- router.js -->
import VueRouter from 'vue-router'
import Vue from 'vue'

import home from'./home.vue'
import messages from'./messages.vue'

Vue.use(VueRouter)

export default newVueRouter({
     routes:[
        {path:'/home',component: home},
        {path:'/messages',component:messages}
      ]
})
阅读 4.2k
2 个回答

export default newVueRouter()这个地方是笔误还是就是写错了?还是看官方文档吧vue-router

用weex自己的navigator

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