1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2025-12-28 12:10:20 +08:00

refactor: simplify wrapper storage

This commit is contained in:
张传龙
2022-07-01 23:27:05 +08:00
parent 90aa54d4a4
commit 57bc68e7b0
7 changed files with 34 additions and 37 deletions

View File

@@ -1,15 +1,21 @@
import { createWebStorage } from './web-storage'
import { createStorage } from './storage'
const prefixKey = 'Vue_Naive_Admin_'
export const createLocalStorage = function (option = {}) {
return createWebStorage({
return createStorage({
prefixKey: option.prefixKey || '',
storage: localStorage,
})
}
export const createSessionStorage = function (option = {}) {
return createWebStorage({
return createStorage({
prefixKey: option.prefixKey || '',
storage: sessionStorage,
})
}
export const lStorage = createLocalStorage({ prefixKey })
export const sStorage = createSessionStorage({ prefixKey })