search

Home  >  Q&A  >  body text

javascript - webpack+vue routing, why router-link reports an error

This is how it is written in the nav.vue component
In main.js
Vue.use(VueRouter);
const routes = [

{ path: '/home', component: Shop },
{ path: '/long', component: LongTerm }

]
const router = new VueRouter({

routes: routes

})
const app = new Vue({

    el: '#inner',
    render: h => h(Shop)

})
The first page of Shop has been loaded,
Then the router-link reported an error, and the value inside was not displayed

曾经蜡笔没有小新曾经蜡笔没有小新2722 days ago841

reply all(3)I'll reply

  • ringa_lee

    ringa_lee2017-06-14 10:56:02

    As follows:

    const app = new Vue({
        router, // 这里必须定义router后传入Vue中啊!
        el: '#inner',
        render: h => h(Shop)
    })

    reply
    0
  • typecho

    typecho2017-06-14 10:56:02

    Router is mounted into vue

    reply
    0
  • 学习ing

    学习ing2017-06-14 10:56:02

    Add a colon before to

    reply
    0
  • Cancelreply