RuoYi
2025-05-15 aadba0382eb1a072a84d98a8789cc743a5394267
delete vue-meta
1 files added
6 files modified
35 ■■■■■ changed files
ruoyi-ui/package.json 1 ●●●● patch | view | raw | blame | history
ruoyi-ui/src/App.vue 10 ●●●● patch | view | raw | blame | history
ruoyi-ui/src/layout/components/Settings/index.vue 1 ●●●● patch | view | raw | blame | history
ruoyi-ui/src/main.js 3 ●●●●● patch | view | raw | blame | history
ruoyi-ui/src/settings.js 5 ●●●●● patch | view | raw | blame | history
ruoyi-ui/src/store/modules/settings.js 2 ●●●●● patch | view | raw | blame | history
ruoyi-ui/src/utils/dynamicTitle.js 13 ●●●●● patch | view | raw | blame | history
ruoyi-ui/package.json
@@ -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"
ruoyi-ui/src/App.vue
@@ -10,15 +10,7 @@
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>
ruoyi-ui/src/layout/components/Settings/index.vue
@@ -144,6 +144,7 @@
          key: 'dynamicTitle',
          value: val
        })
        this.$store.dispatch('settings/setTitle', this.$store.state.settings.title)
      }
    },
  },
ruoyi-ui/src/main.js
@@ -33,8 +33,6 @@
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.use(directive)
Vue.use(plugins)
Vue.use(VueMeta)
DictData.install()
/**
ruoyi-ui/src/settings.js
@@ -1,5 +1,10 @@
module.exports = {
  /**
   * 网页标题
   */
  title: process.env.VUE_APP_TITLE,
  /**
   * 侧边栏主题 深色主题theme-dark,浅色主题theme-light
   */
  sideTheme: 'theme-dark',
ruoyi-ui/src/store/modules/settings.js
@@ -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 @@
  // 设置网页标题
  setTitle({ commit }, title) {
    state.title = title
    useDynamicTitle()
  }
}
ruoyi-ui/src/utils/dynamicTitle.js
New file
@@ -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
  }
}