<script src="../js/vue.js"></script>
<script src="https://unpkg.com/vue-router@2.0.0/dist/vue-router.js"></script>
<router-link to="/user">User</router-link>
<router-link to="/register">Register</router-link>
<router-view></router-view>
const User = {
template: '<h1>User 组件</h1>'
}
const Register = {
template: '<h1>Register 组件</h1>'
}
const router = new VueRouter({
routes: [
{ path: '/user', component: User },
{ path: '/Register', component: Register }
]
})
const vm = new Vue({
el: '#app',
data: {},
router
})