1.每个页面写
mounted(){
documnet.title = "登录"
2.在App.vue里面写
watch:{
$route(){
if(this.$route.path==='/') document.title = "首页";
else if(this.$route.path ==="/login") document.title = "登录";
}
3.在router里面写导航守卫
//路由跳转之前会被此处拦截
//定义路由时候可以配置meta字段 meta:{title:"首页"}
router.beforeEach((to,from,next)=>{
if(to.meta&&to.meta.title){
document.title = to.meta.title
}
next()
})