From d98e489cc5d3856d59061f8a99fa5fe087464cad Mon Sep 17 00:00:00 2001
From: dong_bo0602 <358256383@qq.com>
Date: Tue, 23 Mar 2021 15:12:36 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2title?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package-lock.json | 5 +++++
package.json | 3 ++-
src/App.vue | 2 +-
src/main.js | 8 ++++++++
src/router/index.js | 49 ++++++++++++++++++++++++++++++++-------------
5 files changed, 51 insertions(+), 16 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 1cd59b7..763c524 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10883,6 +10883,11 @@
"integrity": "sha1-HuO8mhbsv1EYvjNLsV+cRvgvWCU=",
"dev": true
},
+ "vue-wechat-title": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npm.taobao.org/vue-wechat-title/download/vue-wechat-title-2.0.5.tgz",
+ "integrity": "sha1-Yo3UvtyhDvObmpj2fKVkpNt3Jgs="
+ },
"watchpack": {
"version": "1.7.5",
"resolved": "https://registry.npm.taobao.org/watchpack/download/watchpack-1.7.5.tgz?cache=0&sync_timestamp=1612715822561&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwatchpack%2Fdownload%2Fwatchpack-1.7.5.tgz",
diff --git a/package.json b/package.json
index 2a818ef..6257e08 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,8 @@
"stylus-loader": "^3.0.2",
"vue": "^2.5.2",
"vue-awesome-swiper": "^2.6.7",
- "vue-router": "^3.0.1"
+ "vue-router": "^3.0.1",
+ "vue-wechat-title": "^2.0.5"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
diff --git a/src/App.vue b/src/App.vue
index 8f14ba6..982cdd8 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,6 +1,6 @@
-
+
diff --git a/src/main.js b/src/main.js
index cbcd1c7..c5725ca 100644
--- a/src/main.js
+++ b/src/main.js
@@ -4,8 +4,10 @@ import Vue from 'vue'
import App from './App'
import router from './router'
import VueAwesomeSwiper from 'vue-awesome-swiper'
+import VueWechatTitle from 'vue-wechat-title'
import 'swiper/dist/css/swiper.css'
Vue.use(VueAwesomeSwiper)
+Vue.use(VueWechatTitle)
import 'styles/reset.css'
Vue.config.productionTip = false
@@ -16,3 +18,9 @@ new Vue({
components: { App },
template: ''
})
+router.beforeEach((to, from, next) => {
+ if (to.meta.title) {
+ document.title = to.meta.title
+ }
+ next()
+})
diff --git a/src/router/index.js b/src/router/index.js
index e4a2870..5a831f5 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -14,37 +14,58 @@ export default new Router({
{
path: '/',
name: 'Index',
- component: Index
- },
+ component: Index,
+ meta: {
+ title: '内蒙古自治区财政厅'
+ }
+ },
{
path: '/dynamic',
name: 'Dynamic',
- component: Dynamic
- },
+ component: Dynamic,
+ meta: {
+ title: '内蒙古自治区财政厅'
+ }
+ },
{
path: '/public',
name: 'Public',
- component: Public
- },
+ component: Public,
+ meta: {
+ title: '内蒙古自治区财政厅'
+ }
+ },
{
path: '/serve',
name: 'Serve',
- component: Serve
- },
+ component: Serve,
+ meta: {
+ title: '内蒙古自治区财政厅'
+ }
+ },
{
path: '/interaction',
name: 'Interaction',
- component: Interaction
- },
+ component: Interaction,
+ meta: {
+ title: '内蒙古自治区财政厅'
+ }
+ },
{
path: '/reply',
name: 'InteractionReply',
- component: InteractionReply
- },
+ component: InteractionReply,
+ meta: {
+ title: '内蒙古自治区财政厅'
+ }
+ },
{
path: '/detail',
name: 'NewsDetail',
- component: NewsDetail
- },
+ component: NewsDetail,
+ meta: {
+ title: '内蒙古自治区财政厅'
+ }
+ },
]
})