uni.setStorageSync('key', [{"note":"男","id":"1","cbm":"1"},{"note":"女","id":"2","cbm":"2"}])
uni.getStorageSync('key')
// 输出 {"0":{"note":"男","id":"1","cbm":"1"},"1":{"note":"女","id":"2","cbm":"2"}}
- 发布:2024-10-31 11:20
- 更新:2024-11-01 19:22
- 阅读:117
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 11
手机系统: HarmonyOS NEXT
手机系统版本号: HarmonyOS NEXT Developer Beta1
手机厂商: 华为
手机机型: Mate 60
页面类型: vue
vue版本: vue3
打包方式: 离线
项目创建方式: CLI
CLI版本号: 3.0.0-alpha-4030120241024002
示例代码:
操作步骤:
uni.setStorageSync('key', [{"note":"男","id":"1","cbm":"1"},{"note":"女","id":"2","cbm":"2"}])
uni.getStorageSync('key')
uni.setStorageSync('key', [{"note":"男","id":"1","cbm":"1"},{"note":"女","id":"2","cbm":"2"}])
uni.getStorageSync('key')
预期结果:
// 输出 [{"note":"男","id":"1","cbm":"1"},{"note":"女","id":"2","cbm":"2"}]
// 输出 [{"note":"男","id":"1","cbm":"1"},{"note":"女","id":"2","cbm":"2"}]
实际结果:
// 输出 {"0":{"note":"男","id":"1","cbm":"1"},"1":{"note":"女","id":"2","cbm":"2"}}
// 输出 {"0":{"note":"男","id":"1","cbm":"1"},"1":{"note":"女","id":"2","cbm":"2"}}
bug描述:
uni.setStorageSync('key', [{"note":"男","id":"1","cbm":"1"},{"note":"女","id":"2","cbm":"2"}])
uni.getStorageSync('key')
// 输出 {"0":{"note":"男","id":"1","cbm":"1"},"1":{"note":"女","id":"2","cbm":"2"}}
3 个回复
最佳回复
DCloud
HBuilderX 4.32.2024110103-alpha 已修复。
码思泉涌 (作者) - y
uni.getStorageSync 有问题 uni.getStorage是正常的
DCloud_UNI_yuhe
感谢反馈,我排查一下
2024-10-31 11:51
DCloud_UNI_yuhe
感谢反馈,问题已确认,之后会修复