新的缓存逻辑

Former-commit-id: a29298a6255c4ab27dae4f6cef1ad95af8edbb63 [formerly a29298a6255c4ab27dae4f6cef1ad95af8edbb63 [formerly a29298a6255c4ab27dae4f6cef1ad95af8edbb63 [formerly a29298a6255c4ab27dae4f6cef1ad95af8edbb63 [formerly 633bc86c464db9626dc7c685527d3b0141aaabcd [formerly a219fab24d89a2dbc45f44c0c5f00d8246fb5dee]]]]]
Former-commit-id: b72ea88277cc8a9f477270b7911919cd65f7d6cf
Former-commit-id: e9aa72de44d189ce01f5898d55f8846adf1a4a12
Former-commit-id: 193b9799bf048d40e9c80ae756e0c70a9e976688 [formerly f250fd937521c1a26908e06534aaeeef53a5c490]
Former-commit-id: abf976b6aca174612973f137e9b19f490e0dd49a
Former-commit-id: 6d5a92cc18402b30bea95166232bb3d1172dba8d
Former-commit-id: 7b93dca709c2506d327e4a6da6989b48d1f6daab
Former-commit-id: da3f5e206587c7e98e3e5fc36f775e08e032f434
Former-commit-id: 6e36d769ce06dfbeacbd2b36c02d107e13354a8b
This commit is contained in:
liyang
2018-07-15 23:47:49 +08:00
parent b1c02025e8
commit ba0e13afbc
3 changed files with 15 additions and 15 deletions

View File

@@ -39,13 +39,10 @@
</div> </div>
<div class="d2-theme-container-main-body"> <div class="d2-theme-container-main-body">
<transition name="fade-transverse"> <transition name="fade-transverse">
<keep-alive> <keep-alive :include="keepAliveList">
<router-view v-if="alive"/> <router-view/>
</keep-alive> </keep-alive>
</transition> </transition>
<transition name="fade-transverse">
<router-view v-if="!alive"/>
</transition>
</div> </div>
</div> </div>
</div> </div>
@@ -77,25 +74,27 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
isGrayMode: state => state.d2admin.isGrayMode isGrayMode: state => state.d2admin.isGrayMode,
pageOpenedList: state => state.d2admin.pageOpenedList
}), }),
...mapGetters([ ...mapGetters([
'themeActiveSetting' 'themeActiveSetting'
]), ]),
/**
* @description 返回现在需要缓存的页面 name
*/
keepAliveList () {
return this.pageOpenedList.filter(item => !(item.meta && item.meta.notCache)).map(e => e.name)
},
/**
* @description 最外层容器的背景图片样式
*/
styleLayoutMainGroup () { styleLayoutMainGroup () {
return { return {
...this.themeActiveSetting.backgroundImage ? { ...this.themeActiveSetting.backgroundImage ? {
backgroundImage: `url('${this.$assetsPublicPath}${this.themeActiveSetting.backgroundImage}')` backgroundImage: `url('${this.$assetsPublicPath}${this.themeActiveSetting.backgroundImage}')`
} : {} } : {}
} }
},
alive () {
if (this.$route.meta) {
if (this.$route.meta.alive) {
return true
}
}
return false
} }
} }
} }

View File

@@ -8,6 +8,7 @@
<script> <script>
export default { export default {
name: 'demo-playground-page-cache-on',
data () { data () {
return { return {
value: '' value: ''

View File

@@ -1 +1 @@
2d74dce7e65ff946e5955a0914be28cbceb8989f 2a044fdc3fd8cc3ef922be2cd4ad59e789502665