<div>首页功能</div>
};
var Category = {
template: <div>分类 {{ $route.params.id }} 功能</div>
};
var router = new VueRouter({
routes: [
{
path: ‘/‘,
component: Index
},
{
path: ‘/category/:id’,
component: Category
},
{
path: ‘/category’,
redirect: ‘/‘
}
]
});
var vm = new Vue({
el: ‘#app’,
router
});
</script>
</body>
</html>