【发布时间】:2017-04-26 22:10:15
【问题描述】:
我正在使用 import { Storage } from '@ionic/storage' storage
使用 this.storage.remove('key'); 时给出运行时错误 Cannot read property 'remove' of undefined
这是我使用的功能代码:this.storage.remove
logout(): void {
this.storage.remove(this.HAS_LOGGED_IN);
this.storage.remove('email');
this.events.publish('user:logout');
};
【问题讨论】:
-
存储在哪里定义?
-
您是否将 @ionic/storage 添加到 app.module.ts 中?
-
是 storage.set() 和 storage.get() 工作正常
-
logout()函数是回调函数吗?
-
没有它的不回调函数