未验证 提交 993c7c34 编写于 作者: 1 189******51 提交者: Gitee

update zh-cn/application-dev/quick-start/arkts-localstorage.md.

Signed-off-by: N189******51 <lipeicheng5@huawei.com>
上级 28458a5f
...@@ -322,14 +322,14 @@ Child自定义组件中的变化: ...@@ -322,14 +322,14 @@ Child自定义组件中的变化:
1. playCountLink的刷新会同步回LocalStorage,并且引起兄弟组件和父组件相应的刷新。 1. playCountLink的刷新会同步回LocalStorage,并且引起兄弟组件和父组件相应的刷新。
```ts ```ts
class Data { class Data {
countStorage: number = 0; countStorage: number = 0;
} }
let data: Data = { countStorage: 1 } let data: Data = { countStorage: 1 }
let storage = new LocalStorage(data); let storage = new LocalStorage(data);
@Component @Component
struct Child { struct Child {
// 子组件实例的名字 // 子组件实例的名字
label: string = 'no name'; label: string = 'no name';
// 和LocalStorage中“countStorage”的双向绑定数据 // 和LocalStorage中“countStorage”的双向绑定数据
...@@ -346,11 +346,11 @@ struct Child { ...@@ -346,11 +346,11 @@ struct Child {
.width(200).height(60).fontSize(12) .width(200).height(60).fontSize(12)
}.width(300).height(60) }.width(300).height(60)
} }
} }
@Entry(storage) @Entry(storage)
@Component @Component
struct Parent { struct Parent {
@LocalStorageLink('countStorage') playCount: number = 0; @LocalStorageLink('countStorage') playCount: number = 0;
build() { build() {
...@@ -386,7 +386,7 @@ struct Parent { ...@@ -386,7 +386,7 @@ struct Parent {
.width(300).height(60).fontSize(12) .width(300).height(60).fontSize(12)
} }
} }
} }
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册