簡體   English   中英

訪問Ionic3中的存儲值

[英]Access to storage values in Ionic3

我希望能夠獲得Ionic 3中最簡單的存儲對象數組,我已經這樣做了:

this.item = Array.of(this.storage.get(‘thestations’));

我在chrome的控制台視圖中得到了這種類型的數組:

[t]
    0: t__zone_symbol__state:  true
        __zone_symbol__value  :  Array(1)

0  : {
    id: “3015”,
    name: “Mansle”,
    latitude: “85.878”,
    longitude: “8.17527”,
    numdept: “16”,
    …
  }

length :  1
proto  :  Array(0)
proto  :  Object
length :  1
proto  :  Array(0)

我希望以簡單的數組獲取此值

{
    id: “3015”,
    name: “Mansle”,
    latitude: “85.878”,
    longitude: “8.17527”,
    numdept: “16”,
    …
  } ?

問候

坦率

請嘗試以下電話。 存儲返回承諾對象,因此您必須使用then()

this.storage.get('thestations').then((val) => {
    console.log(val);
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM