如何使用 Ionic Storage 使用 ionic 3 存储来自 api 的 json 对象? [英] How to use Ionic Storage to store json object from api with ionic 3?
本文介绍了如何使用 Ionic Storage 使用 ionic 3 存储来自 api 的 json 对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何使用 Ionic Storage 来存储带有 Ionic 3 的 Json 对象.我发现这很困难,因为没有 ionic 3 的示例并且我被卡住了.网上好像没有更新.离子存储的支持示例将非常有用.提前谢谢你.
I would like to know how to use Ionic Storage to store Json Object with Ionic 3. I am finding it difficult as there are no examples for the ionic 3 and i am stuck. Nothing on the net seems to be updated. A supporting example for Ionic Storage would be of great use. Thank you in advance.
推荐答案
是的,您可以在 JSON 对象rel="noreferrer">离子存储.
Yes, you can store JSON
objects in Ionic storage.
let your_json_object = { "name":"John", "age":30, "car":null };
// set a key/value
storage.set('my-json', your_json_object);
// to get a key/value pair
storage.get('my-json').then((val) => {
console.log('Your json is', val);
});
这篇关于如何使用 Ionic Storage 使用 ionic 3 存储来自 api 的 json 对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文