html:

 <router-link to="test">Go to Foo</router-link>
<router-link to="test1">Go to Foo1</router-link>
<router-view></router-view>//切换的视图容器

  js:

 var app = new Vue({
el: "#app",
data: {},
router:new VueRouter({
routes:[{
path:"/test",
component:{
template:"<p>111111111</p>"
}
},
{
path:"/test1",
component:{
template:"<p>22222222</p>"
}
}]
}),
})
05-17 01:32