This commit is contained in:
张良(004796)
2024-03-28 19:02:09 +08:00
parent b38001e0de
commit 7a91ff212a
3 changed files with 28 additions and 7 deletions

View File

@@ -13,31 +13,41 @@ const routes = [
{ {
path: '/anti/fraud', path: '/anti/fraud',
name: 'antiFraud', name: 'antiFraud',
title: "防骗指南", meta: {
title: "防骗指南",
},
component: () => import(/* webpackChunkName: "about" */ '../views/AntiFraud.vue') component: () => import(/* webpackChunkName: "about" */ '../views/AntiFraud.vue')
}, },
{ {
path: '/agreement/anchor-join', path: '/agreement/anchor-join',
name: 'anchorJoinAgreement', name: 'anchorJoinAgreement',
title: "主播入驻协议", meta: {
title: "主播入驻协议",
},
component: () => import(/* webpackChunkName: "about" */ '../views/AnchorJoinAgreement.vue') component: () => import(/* webpackChunkName: "about" */ '../views/AnchorJoinAgreement.vue')
}, },
{ {
path: '/agreement/privacy', path: '/agreement/privacy',
name: 'privacyAgreement', name: 'privacyAgreement',
title: "隐私协议", meta: {
title: "隐私协议",
},
component: () => import(/* webpackChunkName: "about" */ '../views/PrivacyAgreement.vue') component: () => import(/* webpackChunkName: "about" */ '../views/PrivacyAgreement.vue')
}, },
{ {
path: '/agreement/user', path: '/agreement/user',
name: 'userAgreement', name: 'userAgreement',
title: "用户协议", meta: {
title: "用户协议",
},
component: () => import(/* webpackChunkName: "about" */ '../views/UserAgreement.vue') component: () => import(/* webpackChunkName: "about" */ '../views/UserAgreement.vue')
}, },
{ {
path: '/share', path: '/share',
name: 'share', name: 'share',
title: "分享", meta: {
title: "分享",
},
component: () => import(/* webpackChunkName: "about" */ '../views/Share.vue') component: () => import(/* webpackChunkName: "about" */ '../views/Share.vue')
}, },
{ {
@@ -54,4 +64,15 @@ const router = new VueRouter({
routes routes
}) })
router.beforeEach((to, from, next) => {
//beforeEach是router的钩子函数在进入路由前执行
if (to.meta.title) {
//判断是否有标题
document.title = to.meta.title
} else {
document.title = '恋香'
}
next()
})
export default router export default router

View File

@@ -21,7 +21,7 @@ export default {
}, },
created() { created() {
queryAgreement().then(response => { queryAgreement().then(response => {
this.agreement = response.data this.agreement = response.data.data
}) })
}, },
methods: { methods: {

View File

@@ -21,7 +21,7 @@ export default {
}, },
created() { created() {
queryAgreement().then(response => { queryAgreement().then(response => {
this.agreement = response.data this.agreement = response.data.data
}) })
}, },
methods: { methods: {