소스 검색

delete vue-meta

RuoYi 11 달 전
부모
커밋
aadba0382e

+ 0 - 1
ruoyi-ui/package.json

@@ -44,7 +44,6 @@
44
     "vue": "2.6.12",
44
     "vue": "2.6.12",
45
     "vue-count-to": "1.0.13",
45
     "vue-count-to": "1.0.13",
46
     "vue-cropper": "0.5.5",
46
     "vue-cropper": "0.5.5",
47
-    "vue-meta": "2.4.0",
48
     "vue-router": "3.4.9",
47
     "vue-router": "3.4.9",
49
     "vuedraggable": "2.24.3",
48
     "vuedraggable": "2.24.3",
50
     "vuex": "3.6.0"
49
     "vuex": "3.6.0"

+ 1 - 9
ruoyi-ui/src/App.vue

@@ -10,15 +10,7 @@ import ThemePicker from "@/components/ThemePicker"
10
 
10
 
11
 export default {
11
 export default {
12
   name: "App",
12
   name: "App",
13
-  components: { ThemePicker },
14
-  metaInfo() {
15
-    return {
16
-      title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
17
-      titleTemplate: title => {
18
-        return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
19
-      }
20
-    }
21
-  }
13
+  components: { ThemePicker }
22
 }
14
 }
23
 </script>
15
 </script>
24
 <style scoped>
16
 <style scoped>

+ 1 - 0
ruoyi-ui/src/layout/components/Settings/index.vue

@@ -144,6 +144,7 @@ export default {
144
           key: 'dynamicTitle',
144
           key: 'dynamicTitle',
145
           value: val
145
           value: val
146
         })
146
         })
147
+        this.$store.dispatch('settings/setTitle', this.$store.state.settings.title)
147
       }
148
       }
148
     },
149
     },
149
   },
150
   },

+ 0 - 3
ruoyi-ui/src/main.js

@@ -33,8 +33,6 @@ import ImageUpload from "@/components/ImageUpload"
33
 import ImagePreview from "@/components/ImagePreview"
33
 import ImagePreview from "@/components/ImagePreview"
34
 // 字典标签组件
34
 // 字典标签组件
35
 import DictTag from '@/components/DictTag'
35
 import DictTag from '@/components/DictTag'
36
-// 头部标签组件
37
-import VueMeta from 'vue-meta'
38
 // 字典数据组件
36
 // 字典数据组件
39
 import DictData from '@/components/DictData'
37
 import DictData from '@/components/DictData'
40
 
38
 
@@ -60,7 +58,6 @@ Vue.component('ImagePreview', ImagePreview)
60
 
58
 
61
 Vue.use(directive)
59
 Vue.use(directive)
62
 Vue.use(plugins)
60
 Vue.use(plugins)
63
-Vue.use(VueMeta)
64
 DictData.install()
61
 DictData.install()
65
 
62
 
66
 /**
63
 /**

+ 5 - 0
ruoyi-ui/src/settings.js

@@ -1,5 +1,10 @@
1
 module.exports = {
1
 module.exports = {
2
   /**
2
   /**
3
+   * 网页标题
4
+   */
5
+  title: process.env.VUE_APP_TITLE,
6
+
7
+  /**
3
    * 侧边栏主题 深色主题theme-dark,浅色主题theme-light
8
    * 侧边栏主题 深色主题theme-dark,浅色主题theme-light
4
    */
9
    */
5
   sideTheme: 'theme-dark',
10
   sideTheme: 'theme-dark',

+ 2 - 0
ruoyi-ui/src/store/modules/settings.js

@@ -1,4 +1,5 @@
1
 import defaultSettings from '@/settings'
1
 import defaultSettings from '@/settings'
2
+import { useDynamicTitle } from '@/utils/dynamicTitle'
2
 
3
 
3
 const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
4
 const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
4
 
5
 
@@ -30,6 +31,7 @@ const actions = {
30
   // 设置网页标题
31
   // 设置网页标题
31
   setTitle({ commit }, title) {
32
   setTitle({ commit }, title) {
32
     state.title = title
33
     state.title = title
34
+    useDynamicTitle()
33
   }
35
   }
34
 }
36
 }
35
 
37
 

+ 13 - 0
ruoyi-ui/src/utils/dynamicTitle.js

@@ -0,0 +1,13 @@
1
+import store from '@/store'
2
+import defaultSettings from '@/settings'
3
+
4
+/**
5
+ * 动态修改标题
6
+ */
7
+export function useDynamicTitle() {
8
+  if (store.state.settings.dynamicTitle) {
9
+    document.title = store.state.settings.title + ' - ' + defaultSettings.title
10
+  } else {
11
+    document.title = defaultSettings.title
12
+  }
13
+}