mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-06 17:36:42 +08:00
案例缓存
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view />
|
||||
<keep-alive :include="['case']">
|
||||
<router-view />
|
||||
</keep-alive>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ import apiType from "@/api/modules/type.js";
|
||||
import { cutFullName } from "@/utils/tools.js";
|
||||
import apiPlace from "@/api/phase2/place.js"
|
||||
export default {
|
||||
name: "index",
|
||||
name: "case",
|
||||
components: {
|
||||
portalHeader,
|
||||
portalFooter,
|
||||
@@ -556,22 +556,26 @@ export default {
|
||||
return !this.speciData.some(item => item.fielclass);
|
||||
}
|
||||
},
|
||||
beforeRouteLeave (to, from, next) {
|
||||
if(to.name !== 'caseDetail'){
|
||||
this.$destroy()
|
||||
}else{
|
||||
sessionStorage.setItem('pagesScroll', JSON.stringify(window.pageYOffset))
|
||||
}
|
||||
next()
|
||||
},
|
||||
beforeRouteEnter(to, from, next) {
|
||||
next(vm=>{
|
||||
vm.$nextTick(() => {
|
||||
window.scrollTo({
|
||||
left: 0,
|
||||
top: JSON.parse(sessionStorage.getItem("pagesScroll")),
|
||||
})
|
||||
sessionStorage.removeItem("pagesScroll")
|
||||
});
|
||||
})
|
||||
},
|
||||
created() {
|
||||
// this.pageScroll = JSON.parse(sessionStorage.getItem("pagesScroll"))
|
||||
// if(this.pageScroll){
|
||||
// this.queryCondition.pageIndex = parseInt(this.pageScroll.pages)
|
||||
// this.queryCondition.type = this.pageScroll.type
|
||||
// this.$nextTick(() => {
|
||||
// if(JSON.parse(sessionStorage.getItem("pagesScroll"))){
|
||||
// window.scrollTo({
|
||||
// left: 0,
|
||||
// top: JSON.parse(sessionStorage.getItem("pagesScroll")).scrollTop,
|
||||
// })
|
||||
// sessionStorage.removeItem("pagesScroll")
|
||||
// }
|
||||
// });
|
||||
// return
|
||||
// }
|
||||
(() => {
|
||||
const allData = {
|
||||
0: {
|
||||
@@ -714,10 +718,6 @@ export default {
|
||||
// window.addEventListener("scroll", this.handleScroll);
|
||||
// 获取年
|
||||
this.getYears();
|
||||
// if(this.pageScroll){
|
||||
// this.queryCondition.pageIndex = parseInt(this.pageScroll.pages)
|
||||
// this.queryCondition.type = this.pageScroll.type
|
||||
// }
|
||||
},
|
||||
beforeDestroy() {
|
||||
// window.removeEventListener("scroll", this.handleScroll);
|
||||
@@ -807,12 +807,6 @@ export default {
|
||||
apiCase.startReadTimer(refId)
|
||||
}
|
||||
this.$router.push({ path: '/case/detail', query: { id } });
|
||||
// this.pageScroll = {
|
||||
// pages: this.queryCondition.pageIndex,
|
||||
// scrollTop: window.pageYOffset,
|
||||
// type: this.queryCondition.type,
|
||||
// }
|
||||
// sessionStorage.setItem('pagesScroll', JSON.stringify(this.pageScroll))
|
||||
},
|
||||
tylClick() {
|
||||
window.open("https://m.qingxuetang.com/x/?appId=qxtcorp306130");
|
||||
|
||||
Reference in New Issue
Block a user