1.创建实例变化的方式
history代替了mode选项
history:createWebHistory(),
hash:createWebHashHistory(),
abstract:createMemoryHistory(),
都移至createWebHistory等方法中
2.移除了通配符 *
routes:[
{
path:'*',
}
]
//代替方式
//pathMatch名称自定义
//(.*)正则表达式表示 所有
//最后一个*是必填项而且是重复的
routes:[
{
path:'/:pathMatch(.*)*',//当前目录下的所有涵盖为匹配的
name:'not-found',
component:NotFound,//组件
}
];
//当匹配到的路径不一致的时候,进行跳转
router.resolve({
name:'not-found',//名称要与routes内名称一致
params:{
pathMatch:['not','found']
},//参数
}).href
3.
4.
5.
to=""更加关注了,指定自定义的内容写在v-slot内