-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
need more infoFurther information is requestedFurther information is requestedquestionThis is a question rather than an issue or pull requestThis is a question rather than an issue or pull request
Description
// Storage二次封装
import config from '../config'
export default {
setItem(key, val) {
let storage = this.getStroage();
storage[key] = val;
window.localStorage.setItem(config.namespace, JSON.stringify(storage));
},
getItem(key) {
return this.getStroage()[key]
},
getStroage() {
return JSON.parse(window.localStorage.getItem(config.namespace) || "{}");
},
clearItem(key) {
let storage = this.getStroage()
delete storage[key]
window.localStorage.setItem(config.namespace, JSON.stringify(storage));
},
clearAll() {
window.localStorage.clear()
}
}
这段代码会报错[plugin:vite:vue] Element is missing end tag.
E:/dl/notbooks/docs/vue/vue3andkoa2/index.md:369:30
369| },
370| getStroage() {
371| return JSON.parse(window.localStorage.getItem(config.namespace) || "{}");
| ^
372| },
373| clearItem(key) {
Metadata
Metadata
Assignees
Labels
need more infoFurther information is requestedFurther information is requestedquestionThis is a question rather than an issue or pull requestThis is a question rather than an issue or pull request