优化h5项目

This commit is contained in:
zhuoda
2021-01-10 20:21:30 +08:00
parent 7e580440f0
commit 606e763126
61 changed files with 878 additions and 923 deletions

View File

@@ -0,0 +1,32 @@
/**
* 整个应用相关的状态信息
*
* 比如: keepalive等
*/
export default {
namespaced: true,
state: {
// 缓存路由
keepAliveIncludes: []
},
mutations: {
// 加入keep-alive缓存
pushKeepAliveIncludes(state, val) {
if (state.keepAliveIncludes.length < 30) {
const number = state.keepAliveIncludes.findIndex(e => e === val);
if (number === -1) {
state.keepAliveIncludes.push(val);
}
}
},
// 删除缓存
deleteKeepAliveIncludes(state, val) {
const number = state.keepAliveIncludes.findIndex(e => e === val);
if (number !== -1) {
state.keepAliveIncludes.splice(number, 1);
}
}
}
};