提交 2a7603aa 编写于 作者: J jiangbo

jiangbo91@huawei.com

add local_storage
Signed-off-by: Njiangbo <jiangbo91@huawei.com>
Change-Id: I75f51188e75df9d8e321ab5883602236cadfd029
上级 1689bf8e
...@@ -72,7 +72,8 @@ export default class MainAbility extends Ability { ...@@ -72,7 +72,8 @@ export default class MainAbility extends Ability {
onBackground() { onBackground() {
// Ability has back to background // Ability has back to background
console.log("[Demo] MainAbility onBackground") console.log("[Demo] MainAbility onBackground")
}} }
}
``` ```
获取页面: 获取页面:
...@@ -102,12 +103,13 @@ struct LocalStorageComponent { ...@@ -102,12 +103,13 @@ struct LocalStorageComponent {
``` ```
let storage = new LocalStorage({"PropA":47}); let storage = new LocalStorage({"PropA":47});
@Entry(storage) @Entry(storage)
@Componentstruct @Component
struct ComA { struct ComA {
@LocalStorageLink("PropA") storLink : number = 1; @LocalStorageLink("PropA") storLink : number = 1;
build() { build() {
Column() { Column() {
Text(`Parent from LocalStorage $(this.storLink)`) .onClick(()=>this.storLink+=1) Text(`Parent from LocalStorage $(this.storLink)`)
.onClick(()=>this.storLink+=1)
Child() Child()
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册