As the title suggests, there are two pages in the code. I want to show the page HelloWorld first then show next page myPage without any click.
(maybe 2 sec after..) How to auto change a page with vue-router
?
I know should set some code in setTimeout
function.
index.js
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import myPage from '@/components/myPage'
Vue.use(Router)
export default new Router({
routes: [{
path: '/',
name: 'HelloWorld',
component: HelloWorld
},
{
path: '/myPage',
name: 'myPage',
component: myPage
}
],
})