no message

Former-commit-id: d97c13ae6a0218e0d6b43b698f6ba065ffa9fabe [formerly d97c13ae6a0218e0d6b43b698f6ba065ffa9fabe [formerly d97c13ae6a0218e0d6b43b698f6ba065ffa9fabe [formerly d97c13ae6a0218e0d6b43b698f6ba065ffa9fabe [formerly 8af3b8cf799f5599a7c708a9c03848e07660f713 [formerly 48d537ed7323a9d26fc3baff4a74e6765385a089]]]]]
Former-commit-id: 8320e4f21313b27cbe1f15589803ab26dd26a065
Former-commit-id: af143dcf993e384f77dc8ab10f881680b3b9252f
Former-commit-id: 4b0bcca697ca8df9084f1cdf1950ff0fc91863ec [formerly 3bb910f2c309c5837f9671fd12663f520d945e41]
Former-commit-id: fac37af6297d5c17188ffe1f60cb3dffa9327de8
Former-commit-id: 8a3939bd303dac222a561c46cb8fbbae94b2ad91
Former-commit-id: ef1c1db97b0713386c94fb5a1ecfaf6c570d1235
Former-commit-id: 534253616edbd0471b7966d2e678388a528398ce
Former-commit-id: 5c549c5924fbd8d7813802089209023404f116a1
This commit is contained in:
liyang
2018-06-30 18:12:02 +08:00
parent e09198e49b
commit 5b1efcf164
5 changed files with 16 additions and 27 deletions

View File

@@ -34,7 +34,7 @@
</div> </div>
<div class="d2-layout-main-body"> <div class="d2-layout-main-body">
<transition name="fade-transverse"> <transition name="fade-transverse">
<keep-alive :include="pageCacheList"> <keep-alive :include="pageUseCacheList">
<router-view/> <router-view/>
</keep-alive> </keep-alive>
</transition> </transition>
@@ -71,7 +71,7 @@ export default {
...mapState({ ...mapState({
themeActive: state => state.d2admin.themeActive, themeActive: state => state.d2admin.themeActive,
isGrayMode: state => state.d2admin.isGrayMode, isGrayMode: state => state.d2admin.isGrayMode,
pageCacheList: state => state.d2admin.pageCacheList pageUseCacheList: state => state.d2admin.pageUseCacheList
}), }),
styleLayoutMainGroup () { styleLayoutMainGroup () {
return { return {

View File

@@ -6,8 +6,7 @@ const db = low(adapter)
db.defaults({ db.defaults({
themeActive: [], themeActive: [],
pageOpenedList: [], pageOpenedList: []
pageCacheList: []
}) })
.write() .write()

View File

@@ -68,7 +68,7 @@ util.openNewPage = function (vm, name, argu, query) {
vm.$store.commit('d2adminTagIncreate', { tag, argu, query }) vm.$store.commit('d2adminTagIncreate', { tag, argu, query })
} }
} }
vm.$store.commit('d2adminPageSetCurrentName', name) vm.$store.commit('d2adminPageCurrentSet', name)
} }
/** /**

View File

@@ -104,6 +104,7 @@ new Vue({
} }
push(frameInRoutes) push(frameInRoutes)
this.$store.commit('d2admintagPoolSet', tagPool) this.$store.commit('d2admintagPoolSet', tagPool)
// d2adminPageUseCacheList
} }
} }
}) })

View File

@@ -19,20 +19,24 @@ export default {
], ],
// 当前页面 // 当前页面
pageCurrent: '', pageCurrent: '',
// 使用缓存的页面 (需要在页面中写 name) // 使用缓存的页面
pageCacheList: [], pageUseCacheList: []
// 不使用缓存的页面
pageDisableCacheList: [
'no-cache'
]
}, },
mutations: { mutations: {
/**
* 设置使用缓存的页面
* @param {state} state vuex state
* @param {array} name pageUseCacheList
*/
d2adminPageUseCacheList (state, list) {
state.pageUseCacheList = list
},
/** /**
* 设置当前激活的页面 name * 设置当前激活的页面 name
* @param {state} state vuex state * @param {state} state vuex state
* @param {string} name new name * @param {string} name new name
*/ */
d2adminPageSetCurrentName (state, name) { d2adminPageCurrentSet (state, name) {
state.pageCurrent = name state.pageCurrent = name
}, },
/** /**
@@ -75,21 +79,6 @@ export default {
let newTag = tag let newTag = tag
newTag.argu = argu || newTag.argu newTag.argu = argu || newTag.argu
newTag.query = query || newTag.query newTag.query = query || newTag.query
// 检查这个页面是不是属于不使用缓存的页面
if (!util.isOneOf(newTag.name, state.pageDisableCacheList)) {
// 在缓存页面的列表加入这个页面的 name
state.pageCacheList.push(newTag.name)
// 更新设置到数据库
const setting = db.get('pageCacheList').find({uuid: util.uuid()})
if (setting.value()) {
setting.assign({value: state.pageCacheList}).write()
} else {
db.get('pageCacheList').push({
uuid: util.uuid(),
value: state.pageCacheList
}).write()
}
}
// 添加进当前显示的页面数组 // 添加进当前显示的页面数组
state.pageOpenedList.push(newTag) state.pageOpenedList.push(newTag)
// 更新设置到数据库 // 更新设置到数据库