feat: 手机端国内/海外/企标-页面缓存

This commit is contained in:
zyn
2023-11-27 17:12:58 +08:00
parent 87346b9b6c
commit 6c6814a4b9
4 changed files with 62 additions and 27 deletions
+4 -1
View File
@@ -13,7 +13,10 @@
<customerService v-if="customerServiceShow"></customerService> <customerService v-if="customerServiceShow"></customerService>
<!-- <router-view v-if="!isBoolean"/>--> <!-- <router-view v-if="!isBoolean"/>-->
<span v-if="this.$route.name === 'Login'|| !isBoolean"> <span v-if="this.$route.name === 'Login'|| !isBoolean">
<router-view/> <keep-alive>
<router-view v-if="$route.meta.keepAlive"/>
</keep-alive>
<router-view v-if="!$route.meta.keepAlive"/>
</span> </span>
<span v-else> <span v-else>
<div class="content-box" v-if="isCollapse"> <div class="content-box" v-if="isCollapse">
@@ -85,9 +85,7 @@ export default {
this.bs.finishPullUp() this.bs.finishPullUp()
}) })
this.bs.on('scroll', (x, y ,z) => { this.bs.on('scroll', ({x, y}) => { })
console.log(x,y,z)
})
} else { } else {
this.bs.refresh() this.bs.refresh()
+53 -22
View File
@@ -127,23 +127,54 @@ export default {
lawsMap:{}, lawsMap:{},
} }
}, },
beforeRouteEnter (to, from, next) {
next(vm => {
// 首页进入 重新加载
if (from.name === 'phoneHome') {
switch (to.query.standType) {
case 'INLAND':
vm.titleName = '国内标准法规库'
break
case 'FOREIGN':
vm.titleName = '海外标准法规库'
break
case 'bussstand':
vm.titleName = '企业标准'
break
case 'POLICY':
vm.titleName = '国内外政策库'
break
}
vm.searchQuery.page = 1
vm.$refs.standardSystemPopupRef.popupShow = true
vm.$refs.scroll.scrollTo(0, 0)
vm.getData()
}
})
},
activated () {
console.log('activated')
},
deactivated () {
console.log('deactivated')
},
created() { created() {
switch (this.$route.query.standType) { // switch (this.$route.query.standType) {
case 'INLAND': // case 'INLAND':
this.titleName = '国内标准法规库' // this.titleName = '国内标准法规库'
break // break
case 'FOREIGN': // case 'FOREIGN':
this.titleName = '海外标准法规库' // this.titleName = '海外标准法规库'
break // break
case 'bussstand': // case 'bussstand':
this.titleName = '企业标准' // this.titleName = '企业标准'
break // break
case 'POLICY': // case 'POLICY':
this.titleName = '国内外政策库' // this.titleName = '国内外政策库'
break // break
} // }
this.getDicTypeListCode() this.getDicTypeListCode()
this.getData() // this.getData()
}, },
methods: { methods: {
pullingUpHandler () { pullingUpHandler () {
@@ -269,14 +300,14 @@ export default {
line-height: 40px; line-height: 40px;
font-size: 18px; font-size: 18px;
.left-title { .left-title {
margin-left: 10px; margin-left: 10px;
} }
.right-title { .right-title {
float: right; float: right;
margin-right: 34%; margin-right: 34%;
} }
} }
.van-search { .van-search {
+4 -1
View File
@@ -114,7 +114,10 @@ const routes = [
{ {
path: '/domesticStand', path: '/domesticStand',
name: 'domesticStand', name: 'domesticStand',
component: () => import('@/pages/phone/domesticStand/index') component: () => import('@/pages/phone/domesticStand/index'),
meta: {
keepAlive: true
}
/* /*
component: () => component: () =>
import('@/pages/phone/domesticStand') import('@/pages/phone/domesticStand')