import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
{
path: '/',
name: 'home',
meta: {
title: '阜宁文体中心统一管理平台'
},
component: () => import('../views/HomeView.vue')
},
]
const router = createRouter({
history: createWebHashHistory(),
routes
})
//+++++++++++ 同步你的meta.title 方法
router.beforeEach(async (to, from, next) => {
if (to.meta.title) {
document.title = to.meta.title
} else {
document.title = '数据大屏'
}
await next()
})
export default router
vue项目修改页面标题名称
于 2024-12-20 10:16:22 首次发布