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