0

我一直在尝试互联网上的所有内容,但仍然收到此错误错误错误:未捕获(承诺中):TypeError:无法读取未定义的属性'then'

ionic cordova run browser即使我在 android studio 模拟器上尝试运行它仍然无法正常工作,请帮我解决这个问题,这是我来自 db.service.ts 的代码

    private platform: Platform, 
    private sqlite: SQLite, 
    private httpClient: HttpClient,
    private sqlPorter: SQLitePorter,
  ) {
    this.platform.ready().then(() => {
      this.sqlite.create({
        name: 'positronx_db.db',
        location: 'default'
      })
      .then((db: SQLiteObject) => {
          this.storage = db;
          this.getFakeData();
      });
    });
  }

  dbState() {
    return this.isDbReady.asObservable();
  }
 
  fetchSongs(): Observable<Song[]> {
    return this.songsList.asObservable();
  }```

4

1 回答 1

0

我相信这是因为插件不支持浏览器平台。你必须在真实的​​设备上试试这个,我相信一切都会为你工作。

https://ionicframework.com/docs/native/sqlite

于 2021-01-12T08:27:55.673 回答