以下是我的组件代码
import { SQLite, SQLiteObject } from '@ionic-native/sqlite';
constructor(private sqlite: SQLite){
this.createTransactions();
}
createTransactions(){
this.sqlite.create({
name: 'sample.db',
location: 'default'
}).then((db: SQLiteObject) => {
db.executeSql('CREATE TABLE IF NOT EXISTS transactions(transaction_id TEXT PRIMARY KEY, user_id TEXT, order_date DATE, order_number INTEGER, invoice_date DATE, processed_date DATE, transaction_amount FLOAT)')
.then(res => alert('Executed SQL'))
.catch(e => alert('cannot create table'+JSON.stringify(e))); //alerting this
}).catch(e => alert('lite'+JSON.stringify(e)));
}
有人可以告诉我哪里做错了吗?