var storage={
set(key,value){
loackStorage.setItem(key,JSON.stringify(value)),
get(key){
return JSON.parse(locakStorage.getItem(key))
}
remove(key){
localStorage.removeItem(key)
}
//在把他暴露出去
export default storage
var storage={
set(key,value){
loackStorage.setItem(key,JSON.stringify(value)),
get(key){
return JSON.parse(locakStorage.getItem(key))
}
remove(key){
localStorage.removeItem(key)
}
//在把他暴露出去
export default storage
本文标题:vue中的本地存储进行封装 模块化文件
本文链接:https://www.haomeiwen.com/subject/lufcbqtx.html
网友评论