solt插槽的使用。

时间:2022-03-08 15:49:32
在组件内template中使用 <slot name='header'></slot>
在页面内 直接添加标签 如 <hs><h1 slot='header'></h1></hs> 用来匹配这些元素。
<slot></slot> 帮助在组件内进行 占位 具有name属性 用来进行区别他们的位置。

this.$router.push({name:home,params:{id:5555}});编码式路由

router 可以有name属性用来起名

router具有path 属性 components属性 必须填写的两个属性。

let router = new VueRouter({
mode:'hash'//带#号 'history' //类似于后端接口
LinkActiveClass:'class名'; //动态切换, 默认router-link-active 就自带动态切换。
routers:[
{
path:'/home';
name:'Home',
components:{
template:''
}
},
{},
{}
]
});