@@ -44,7 +44,6 @@
"vue": "2.6.12",
"vue-count-to": "1.0.13",
"vue-cropper": "0.5.5",
- "vue-meta": "2.4.0",
"vue-router": "3.4.9",
"vuedraggable": "2.24.3",
"vuex": "3.6.0"
@@ -10,15 +10,7 @@ import ThemePicker from "@/components/ThemePicker"
export default {
name: "App",
- components: { ThemePicker },
- metaInfo() {
- return {
- title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
- titleTemplate: title => {
- return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
- }
+ components: { ThemePicker }
}
</script>
<style scoped>
@@ -144,6 +144,7 @@ export default {
key: 'dynamicTitle',
value: val
})
+ this.$store.dispatch('settings/setTitle', this.$store.state.settings.title)
},
@@ -33,8 +33,6 @@ import ImageUpload from "@/components/ImageUpload"
import ImagePreview from "@/components/ImagePreview"
// 字典标签组件
import DictTag from '@/components/DictTag'
-// 头部标签组件
-import VueMeta from 'vue-meta'
// 字典数据组件
import DictData from '@/components/DictData'
@@ -60,7 +58,6 @@ Vue.component('ImagePreview', ImagePreview)
Vue.use(directive)
Vue.use(plugins)
-Vue.use(VueMeta)
DictData.install()
/**
@@ -1,4 +1,9 @@
module.exports = {
+ /**
+ * 网页标题
+ */
+ title: process.env.VUE_APP_TITLE,
+
* 侧边栏主题 深色主题theme-dark,浅色主题theme-light
*/
@@ -1,4 +1,5 @@
import defaultSettings from '@/settings'
+import { useDynamicTitle } from '@/utils/dynamicTitle'
const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
@@ -30,6 +31,7 @@ const actions = {
// 设置网页标题
setTitle({ commit }, title) {
state.title = title
+ useDynamicTitle()
@@ -0,0 +1,13 @@
+import store from '@/store'
+import defaultSettings from '@/settings'
+/**
+ * 动态修改标题
+export function useDynamicTitle() {
+ if (store.state.settings.dynamicTitle) {
+ document.title = store.state.settings.title + ' - ' + defaultSettings.title
+ } else {
+ document.title = defaultSettings.title
+ }
+}