vue 缓存与获取缓存
1.创建storage.js// 封装localStorsge本地储存方法var storage = {set(key, value) {localStorage.setItem(key, JSON.stringify(value));},get(key) {return JSON.parse(localStorage.getIte...
·
1.创建storage.js
// 封装localStorsge本地储存方法
var storage = {
set(key, value) {
localStorage.setItem(key, JSON.stringify(value));
},
get(key) {
return JSON.parse(localStorage.getItem(key));
},
remove(key) {
localStorage.removeItem(key)
}
}
export default storage
2 . 引用
import Storage from '@/model/storage.js'
更多推荐
已为社区贡献8条内容
所有评论(0)