front-template/src/plugins/title.ts
2025-01-07 15:29:05 +08:00

18 lines
312 B
TypeScript

import { router } from './router'
useTitle(
() => {
const { path, meta } = router.currentRoute.value
if (meta.title) {
return `· ${meta.title}`
}
if (path === '/') {
return '· home'
}
return path.replaceAll('/', ' · ')
},
{
titleTemplate: `${import.meta.env.VITE_APP_TITLE} %s`,
},
)