动态改变颜色
Former-commit-id: 1915e090833022dc051aa9cdc18547dbe38fa926 [formerly 1915e090833022dc051aa9cdc18547dbe38fa926 [formerly 1915e090833022dc051aa9cdc18547dbe38fa926 [formerly 1915e090833022dc051aa9cdc18547dbe38fa926 [formerly 27b9dffa48083e7d9838f32b8981c30abfc951f0 [formerly 06cbe3b2364c0a802527426b9fb2945c79521492]]]]] Former-commit-id: 00c4123c1d7eb8c098d62f9d82c9fbe5286722bb Former-commit-id: 8a034bad24ce45a2180974bec4bb98aa22136872 Former-commit-id: c208536ddbb4a1ee18d0b4c6985e02ec857bdf52 [formerly 1651b96ca9070d2cd743063fafb83dd06b31403e] Former-commit-id: aec7f7119c7ac86d848dcb3226c4f018284a7470 Former-commit-id: ea29897c0709a4348a85161429003ba4405f59aa Former-commit-id: 5161b39309ce5c69a4ba3ea37ad85b6bbbab258b Former-commit-id: 0804b0bb33ea9e286fbde79c834e97952e86d63d Former-commit-id: 487a27193d189c11d12a79d339a5c1800d157597
This commit is contained in:
@@ -107,6 +107,7 @@ export default {
|
||||
await dispatch('d2admin/menu/asideCollapseLoad', null, { root: true })
|
||||
// DB -> store 持久化数据加载全局尺寸
|
||||
await dispatch('d2admin/size/load', null, { root: true })
|
||||
await dispatch('d2admin/color/load', null, { root: true })
|
||||
// end
|
||||
resolve()
|
||||
})
|
||||
|
||||
46
src/store/modules/d2admin/modules/color.js
Normal file
46
src/store/modules/d2admin/modules/color.js
Normal file
@@ -0,0 +1,46 @@
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
// 颜色
|
||||
value: process.env.VUE_APP_ELEMENT_COLOR
|
||||
},
|
||||
actions: {
|
||||
/**
|
||||
* @description 设置颜色
|
||||
* @param {Object} state vuex state
|
||||
* @param {String} color 尺寸
|
||||
*/
|
||||
set ({ state, dispatch }, color) {
|
||||
return new Promise(async resolve => {
|
||||
// store 赋值
|
||||
state.value = color
|
||||
// 持久化
|
||||
await dispatch('d2admin/db/set', {
|
||||
dbName: 'sys',
|
||||
path: 'color.value',
|
||||
value: state.value,
|
||||
user: true
|
||||
}, { root: true })
|
||||
// end
|
||||
resolve()
|
||||
})
|
||||
},
|
||||
/**
|
||||
* @description 从持久化数据读取颜色设置
|
||||
* @param {Object} state vuex state
|
||||
*/
|
||||
load ({ state, dispatch }) {
|
||||
return new Promise(async resolve => {
|
||||
// store 赋值
|
||||
state.value = await dispatch('d2admin/db/get', {
|
||||
dbName: 'sys',
|
||||
path: 'color.value',
|
||||
defaultValue: process.env.VUE_APP_ELEMENT_COLOR,
|
||||
user: true
|
||||
}, { root: true })
|
||||
// end
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user