我正在使用**import {.1'来自'@ionic/storage'**存储
给运行时错误当使用this.storage.remove('key')时,无法读取未定义的属性'remove';
这是我的功能代码,其中我 used:this.storage.remove
logout(): void {
this.storage.remove(this.HAS_LOGGED_IN);
this.storage.remove('email');
this.events.publish('user:logout');
};
2 回答
您必须在构造函数中注入
storage
对象:请注意,您还必须在应用中注册存储模块:
见这个文件
安装 ionic-native 包> $ npm install ionic-native --save
并使用它像:
如果你没有使用包装,你不需要注入它