【发布时间】:2023-03-20 17:16:01
【问题描述】:
我的本地存储中有以下数据:
[{
"event": "addToCart",
"eventLabel": "Test Product",
"ecommerce": {
"currencyCode": "USD",
"add": {
"products": [{
"name": "Test Product",
"id": "78789",
"price": "429.00",
"category": "Catalog Page",
"list": "Massage\/Massage Chairs\/Portable Massage Chairs",
"quantity": "1"
}]
}
}
}]
我需要访问ecommerce 的值。于是得到如下数据:
"ecommerce": {
"currencyCode": "USD",
"add": {
"products": [{
"name": "Test Product",
"id": "78789",
"price": "429.00",
"category": "Catalog Page",
"list": "Massage\/Massage Chairs\/Portable Massage Chairs",
"quantity": "1"
}]
}
}
我该怎么做?
【问题讨论】:
-
这能回答你的问题吗? how to retrieve data from local storage?
-
不,我可以获取本地存储,但我不知道如何像上面提到的那样创建数组
标签: javascript object local-storage