localStorage sessionStorage vue 本地缓存 hook

2020-04-09 11:49:09 浏览数 (2)

localStorage
代码语言:javascript复制
import { ref } from '@vue/composition-api'


import strongeStateHook from './strongeStateHook'

export default function localStorageStateHook(key, defaultValue){
    return strongeStateHook(localStorage, key, defaultValue)
}
sessionStorage
代码语言:javascript复制
import { ref } from '@vue/composition-api'


import strongeStateHook from './strongeStateHook'

export default function sessionStorageStateHook(key, defaultValue){
    return strongeStateHook(sessionStorage, key, defaultValue)
}

0 人点赞