feat 页面标题和页面的favicon.ico动态修复
This commit is contained in:
22
src/main.ts
22
src/main.ts
@@ -30,6 +30,8 @@ import './permission';
|
||||
|
||||
// 国际化
|
||||
import i18n from '@/lang/index';
|
||||
import { useSettingsStore } from '@/store/modules/settings';
|
||||
import { getDemo } from '@/api/systemList/index';
|
||||
|
||||
// vxeTable
|
||||
import VXETable from 'vxe-table';
|
||||
@@ -54,4 +56,24 @@ app.use(plugins);
|
||||
// 自定义指令
|
||||
directive(app);
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
getDemo()
|
||||
.then((res) => {
|
||||
const name = res?.data?.name;
|
||||
const url = res?.data?.url;
|
||||
if (name || url) {
|
||||
settingsStore.setSystemInfo(name || '', url || '');
|
||||
|
||||
if (url) {
|
||||
const link = document.querySelector("link[rel='icon']") as HTMLLinkElement | null;
|
||||
if (link) {
|
||||
link.href = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// ignore
|
||||
});
|
||||
|
||||
app.mount('#app');
|
||||
|
||||
Reference in New Issue
Block a user