1.如果需要使用SQLite,先安装 Cordova-sqlite-storage ,命令行输入
ionic cordova plugin add cordova-sqlite-storage
npm install --save @ionic-native/sqlite
2 在 ./src/app/app.module.ts 中添加
import { IonicStorageModule } from '@ionic/storage';
@NgModule({
declarations: [...],
imports: [
...,
IonicStorageModule.forRoot({
name: 'myApp',
driverOrder: ['sqlite', 'indexeddb', 'websql']
})
],
bootstrap: [...],
entryComponents: [...],
providers: [...]
})
export class AppModule { }