0.新建一个组件Brand
1.在router/index.js中添加
//导入
import Brand from '@/components/Brand'
//在routes中添加
{
path: '/brand',
name: 'Brand',
component: Brand
}
2.在父页面中添加
//用来替代组件
<router-view/>
//点击触发替换
//to="/brand"为router中定义的路径,“品牌”为连接显示的名称
//页面加载是默认把<router-view/>替换为路径为"/"的页面
<router-link to="/brand">品牌</router-link>
3.代码导航(子组件替换)
this.$router.push({path: '/brand'})