HarmonyOS LocalStorage怎么在Navigation中使用

如果是route的页面可以通过@Entry(storage)绑定共享数据, 如果导航切换到Navigation 应该怎么使用?

HarmonyOS
2024-08-30 16:04:38
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
put_get

LocalStorage的实例仅仅在一个@Entry装饰的组件和其所属的子组件(一个页面)中共享,可以借助LocalStorage相关的两个装饰器@LocalStorageProp和@LocalStorageLink,在UI组件内部获取到LocalStorage实例中存储的状态变量。具体API参考指南如下:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-localstorage-V5

localstorageprop和localstorage单向同步的简单场景:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-localstorage-V5#localstorageprop和localstorage单向同步的简单场景

localstoragelink和localstorage双向同步的简单场景:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/arkts-localstorage-V5#localstoragelink和localstorage双向同步的简单场景

分享
微博
QQ
微信
回复
2024-09-02 16:30:45
相关问题
如何在Navigation中使用LocalStorage
160浏览 • 1回复 待解决
HarmonyOS 安全控件无法弹窗中使用
151浏览 • 1回复 待解决
image组件中使用bindContextMenu报错
131浏览 • 1回复 待解决
HarmonyOS Navigation 使用问题
92浏览 • 1回复 待解决
HarmonyOS Web组件使用localStorage报错
120浏览 • 1回复 待解决
getContext(this)能否自定义类中使用
1931浏览 • 1回复 待解决
自定义组件中使用@ObjectLink报错
367浏览 • 1回复 待解决
开源的中间件能否PolarDB中使用?
2388浏览 • 1回复 待解决
@watch中使用异步方法后UI反应慢
152浏览 • 1回复 待解决
jenkins容器中使用docker报错问题
7256浏览 • 2回复 待解决