TypeError:无法在Ionic中设置undefined的属性

时间:2018-12-19 09:31:58

标签: javascript ionic-framework pouchdb

我使用Ionic Framework,并尝试显示pouchdb中的数据。

我从ionViewWillEnter调用readParcelle函数,然后出现此错误:TypeError:无法设置未定义的属性“ items”

 readParcelle() {

    this.parcelles = new PouchDB('parcelles');

        //Get parcelles from PouchDB

        this.parcelles.allDocs({
            include_docs: true
            }).then(function (result) {

              var items= [];

              this.items = result;

            }).catch(function (err) {
            console.log(err);
        });

  }

 ionViewWillEnter() : void
   {   

      this.readParcelle();

   }

0 个答案:

没有答案
相关问题