Vue: [Router] router.start is not in either migration and/or migration-helper

Created on 7 Oct 2016  ·  1Comment  ·  Source: vuejs/vue

My old code was

var App = require('./component/App.vue');

var router = new VueRouter();
router.transitionOnLoad = true;
router.map({
    '/': {
        component: FrontComponent
    }
});

router.redirect({
    '*': '/'
});

router.start(App, '#app');

After running migration tool my code is

var App = require('./component/App.vue');

var router = new VueRouter({
    routes: [
        { path: '*', redirect: '/' },
        { path: '/', component: FrontComponent },
        { path: '/:station', component: BoardComponent },
        { path: '/:station/:url', component: JourneyComponent }
    ]
});
router.start(App, '#app');

Im getting this Uncaught TypeError: router.start is not a function so I looked through vue router migration but router.start is not defined anywhere.

Then I looked in the docs for router 2.0, but router.start is not defined anywhere, and the getting started is just

const app = new Vue({
  router
}).$mount('#app')

But I use a .vue file to generate my app, so I'm a bit lost on what to do

Most helpful comment

Hi, thanks for filling this issue, can you open this on the migration helper's repo instead? Thanks!

As for your question, simply do:

var App = require('./component/App.vue');
const app = new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

>All comments

Hi, thanks for filling this issue, can you open this on the migration helper's repo instead? Thanks!

As for your question, simply do:

var App = require('./component/App.vue');
const app = new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
Was this page helpful?
0 / 5 - 0 ratings

Related issues

guan6 picture guan6  ·  3Comments

hiendv picture hiendv  ·  3Comments

wufeng87 picture wufeng87  ·  3Comments

robertleeplummerjr picture robertleeplummerjr  ·  3Comments

fergaldoyle picture fergaldoyle  ·  3Comments