Ver código fonte

修改设置网站头像位置

dusenyao 11 meses atrás
pai
commit
b78ed39e56
2 arquivos alterados com 9 adições e 9 exclusões
  1. 9 0
      src/App.vue
  2. 0 9
      src/layouts/components/LayoutHeader.vue

+ 9 - 0
src/App.vue

@@ -36,6 +36,15 @@ export default {
   },
   created() {
     this.handleUserAgentRoot();
+    const { token: config, isHas: isConfigHas } = getConfig();
+    // 有 config 信息时,设置 icon
+    if (isConfigHas) {
+      const link = document.querySelector("link[rel*='icon']") || document.createElement('link');
+      link.type = 'image/x-icon';
+      link.rel = 'shortcut icon';
+      link.href = config.title_icon_url;
+      document.getElementsByTagName('head')[0].appendChild(link);
+    }
     // ['click', 'mousewheel', 'mousemove'].forEach((item) => {
     //   window.addEventListener(item, () => {
     //     sessionStorage.setItem('lastClickTime', new Date().getTime());

+ 0 - 9
src/layouts/components/LayoutHeader.vue

@@ -94,15 +94,6 @@ if (isHas) {
   getLangList();
 }
 
-const { token: config, isHas: isConfigHas } = getConfig();
-if (isConfigHas) {
-  const link = document.querySelector("link[rel*='icon']") || document.createElement('link');
-  link.type = 'image/x-icon';
-  link.rel = 'shortcut icon';
-  link.href = config.title_icon_url;
-  document.getElementsByTagName('head')[0].appendChild(link);
-}
-
 // 切换导航
 function handleSelect() {
   window.location.href = '/';