<div id="app">
<router-link to="/stu">STU</router-link>
<router-view></router-view>
</div> script脚本
定义组件配置对象;
const Stu = {template:'<div>浅浅时光</div>'}
const routes = [{path:"/stu",component:Stu}];
创建路由对象
const router = new VueRouter({
// 定义路由规则;
routes
})new Vue({
el:"#app",
注册一下路由对象(缩写 == router:router);
router
})
script脚本

京公网安备 11010502036488号