diff --git a/ruoyi-ui/public/favicon.ico b/ruoyi-ui/public/favicon.ico index e263760..a615ef5 100644 Binary files a/ruoyi-ui/public/favicon.ico and b/ruoyi-ui/public/favicon.ico differ diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js index 0a79c74..f916a9f 100644 --- a/ruoyi-ui/src/main.js +++ b/ruoyi-ui/src/main.js @@ -69,15 +69,12 @@ Vue.use(plugins) Vue.use(VueMeta) DictData.install() -/** - * If you don't want to use mock-server - * you want to use MockJs for mock api - * you can execute: mockXHR() - * - * Currently MockJs will be used in the production environment, - * please remove it before going online! ! ! - */ - +router.beforeEach((to, from, next) => { + if (to.meta.metaInfo) { + store.commit("CAHNGE_META_INFO", to.meta.metaInfo) + } + next() +}); Vue.use(Element, { size: Cookies.get('size') || 'medium' // set element-ui default size }) @@ -88,5 +85,17 @@ new Vue({ el: '#app', router, store, + metaInfo() { + return { + title: this.$store.state.metaInfo.title, + meta: [{ + name: "keywords", + content: this.$store.state.metaInfo.keywords + }, { + name: "description", + content: this.$store.state.metaInfo.description + }] + } + }, render: h => h(App) }) diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index b9aa83f..9c1febd 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -44,6 +44,7 @@ export const constantRoutes = [ { path: '/virtually',//首页 name:'virtually', + meta: { title: '首页' }, component: () => import('@/views/home'), hidden: true }, diff --git a/ruoyi-ui/src/store/index.js b/ruoyi-ui/src/store/index.js index 97aaef8..54a3fa8 100644 --- a/ruoyi-ui/src/store/index.js +++ b/ruoyi-ui/src/store/index.js @@ -19,6 +19,16 @@ const store = new Vuex.Store({ permission, settings }, + state: { + metaInfo: {},//网站三要素 + token:'', //token + + }, + mutations: { + CAHNGE_META_INFO(state, metaInfo) { + state.metaInfo = metaInfo; + }, + }, getters }) diff --git a/ruoyi-ui/src/views/home.vue b/ruoyi-ui/src/views/home.vue index 45c8342..4db82a7 100644 --- a/ruoyi-ui/src/views/home.vue +++ b/ruoyi-ui/src/views/home.vue @@ -268,6 +268,14 @@ export default { } }, mounted() { + let metaInfo = { + title: '首页', + keywords: '首页', + description: '首页', + } + document.title = '新的页面标题'; + + this.$store.commit('CAHNGE_META_INFO', metaInfo) // 页面加载完毕调用 this.tabLsit(); this.getWebBaseInfo() diff --git a/ruoyi-ui/src/views/officialWebsite/about.vue b/ruoyi-ui/src/views/officialWebsite/about.vue index ca7cfd3..e17cc43 100644 --- a/ruoyi-ui/src/views/officialWebsite/about.vue +++ b/ruoyi-ui/src/views/officialWebsite/about.vue @@ -10,9 +10,10 @@