码思泉涌
码思泉涌
  • 发布:2024-10-31 11:20
  • 更新:2024-11-01 19:22
  • 阅读:239

【报Bug】4.31 uni.setStorageSync() 方法,鸿蒙保存数组,读取后是对象

分类:鸿蒙Next

产品分类: 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')  

// 输出 {"0":{"note":"男","id":"1","cbm":"1"},"1":{"note":"女","id":"2","cbm":"2"}}

操作步骤:
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"}]

实际结果:

// 输出 {"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"}}

2024-10-31 11:20 负责人:DCloud_UNI_yuhe 分享
已邀请:

最佳回复

DCloud

DCloud

HBuilderX 4.32.2024110103-alpha 已修复。

  • 6***@qq.com

    请问修复了吗? 为什么我4.33.2024111702-alpha还是有这个问题

    2024-11-19 15:40

码思泉涌

码思泉涌 (作者) - y

uni.getStorageSync 有问题 uni.getStorage是正常的

DCloud_UNI_yuhe

DCloud_UNI_yuhe

感谢反馈,问题已确认,之后会修复

要回复问题请先登录注册