I am began get this error suddenly. I'm using webpack and babel. in my storage class everything fine.
I'm using storege class like this
import Storage from './storage'
let DB = new Storage();
I didn't update the babel. I don't know source of error maybe webpack?
my storage.js look like this
import localStorage from './localStorage'
import View from './view'
let lStore = new localStorage();
let V = new View();
let data = (lStore.get('todo')) ? JSON.parse(lStore.get('todo')):{
todo: [],
complated: []
};
export default class Storage {
addItem(text, id){
/* Store */
this.store(text);
/* Add HTML Item */
V.addToDOM(text, id);
}
store(text){
data.todo.push(text);
data.complated.push(false);
//sync
this.objectLocalStorage();
}
list() {
return data;
}
updateItem(id, complated){
/* */
data.complated[id] = complated;
//sync
this.objectLocalStorage();
}
deleteItem(id){
data.complated.splice(id, 1);
data.todo.splice(id, 1);
//sync
this.objectLocalStorage();
}
/* Local Storage Set-Update-Sync */
objectLocalStorage() {
lStore.set('todo', JSON.stringify(data));
}}
Try:
import { Storage } from './storage'
let DB = new Storage();
Storage is probably not the default export of the storage.js file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.