Vue.js路由实现选项卡简单实例

2020-06-14 06:31:00易采站长站整理

}
}
});
const Javascript = Vue.extend({
template: '<div><h1>Javascript</h1><p>{{msg}}</p></div>',
data(){
return{
msg: 'This is the Javascript vue-router.'
}
}
});
const router = new VueRouter({
routes: [
{ path: '/html', component: Html },
{ path: '/css', component: Css },
{ path: '/vue', component: Vue1 },
{ path: '/javascript', component: Javascript },
{ path: '/', component: Html } //默认路径
] });
const vm = new Vue({
router: router
}).$mount('#app');
</script>
</body>
</html>

如有错误之处,欢迎指出,万分感谢!