🐛 修复页面标题异常

This commit is contained in:
hi2hi 2024-12-23 04:46:12 +00:00
parent 7a2e22c30c
commit 61fe45927e
3 changed files with 10 additions and 5 deletions

View File

@ -41,7 +41,11 @@ const routerOptions = {
const router = createRouter(routerOptions);
router.beforeResolve((to, from, next) => {
pageTitle(to?.meta?.title);
if (to?.meta?.title) {
pageTitle(to?.meta?.title);
} else if (to.name === 'Home') {
pageTitle(config.nazhua.title);
}
next();
});

View File

@ -1,5 +1,6 @@
import config from '@/config';
export default (...args) => {
document.title = [...args, config.nazhua.title].filter((i) => i).join(' - ');
const titles = [...new Set([...args, config.nazhua.title])].filter((i) => i);
document.title = titles.join(' - ');
};

View File

@ -130,9 +130,9 @@ function handleWorldMapWidth() {
);
}
watch(() => info.value, () => {
if (info.value) {
pageTitle(info.value?.Name, '节点详情');
watch(() => info.value, (oldValue, newValue) => {
if (!oldValue && newValue && router.currentRoute.value.name === 'ServerDetail') {
pageTitle(newValue?.Name, '节点详情');
handleWorldMapWidth();
}
});