修改升级日志
This commit is contained in:
@@ -3,8 +3,13 @@
|
||||
* @method set 设置
|
||||
* @method get 获取
|
||||
* @method remove 移除
|
||||
* @method clear 移除全部
|
||||
* @method clear 移除全部(保留表格列配置、Pinia DevTools 设置)
|
||||
*/
|
||||
const LOCAL_STORAGE_PRESERVE_KEYS = [
|
||||
'VXE_CUSTOM_STORE',
|
||||
'__VUE_DEVTOOLS_NEXT_PLUGIN_SETTINGS__dev.esm.pinia__'
|
||||
]
|
||||
|
||||
export const Local = {
|
||||
set(key: string, val: any) {
|
||||
window.localStorage.setItem(key, JSON.stringify(val))
|
||||
@@ -17,7 +22,15 @@ export const Local = {
|
||||
window.localStorage.removeItem(key)
|
||||
},
|
||||
clear() {
|
||||
const preserved: Record<string, string> = {}
|
||||
for (const key of LOCAL_STORAGE_PRESERVE_KEYS) {
|
||||
const value = window.localStorage.getItem(key)
|
||||
if (value !== null) preserved[key] = value
|
||||
}
|
||||
window.localStorage.clear()
|
||||
for (const [key, value] of Object.entries(preserved)) {
|
||||
window.localStorage.setItem(key, value)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user