提交 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 {
onBackground() {
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}}
}
}
```
获取页面:
......@@ -89,8 +90,8 @@ struct LocalStorageComponent {
.onClick(()=>{
this.simpleVarName +=1;
})
Text(JSON.stringify(this.simpleVarName))
.fontSize(50)
Text(JSON.stringify(this.simpleVarName))
.fontSize(50)
}
.height(500)
}
......@@ -102,14 +103,15 @@ struct LocalStorageComponent {
```
let storage = new LocalStorage({"PropA":47});
@Entry(storage)
@Componentstruct
@Component
struct ComA {
@LocalStorageLink("PropA") storLink : number = 1;
build() {
Column() {
Text(`Parent from LocalStorage $(this.storLink)`) .onClick(()=>this.storLink+=1)
Child()
}
Column() {
Text(`Parent from LocalStorage $(this.storLink)`)
.onClick(()=>this.storLink+=1)
Child()
}
}
}
......@@ -118,8 +120,8 @@ struct ComA {
struct Child{
@LocalStorageLink("PropA") storLink : number = 1;
build() {
Text(`Parent from LocalStorage $(this.storLink)`)
.onClick(()=>this.storLink1+=1)
Text(`Parent from LocalStorage $(this.storLink)`)
.onClick(()=>this.storLink1+=1)
}
}
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册