1.插件集成
ionic cordova plugin add cordova-sqlite-storage
npm install --save @ionic-native/sqlite
2.项目中引入
在app.module.ts中加入
import { SQLite, SQLiteObject } from ‘@ionic-native/sqlite’;
在providers中加入
SQLite,
3.页面引入
在需要使用sqlite的页面中引入
import { SQLite, SQLiteObject } from ‘@ionic-native/sqlite’;
database: SQLiteObject;
private sqlite: SQLite,
4.数据库初始化
initDataBase() {
var sqlStr = "create table if not exists taskListTable(id integer primary key autoincrement," <