提交 1689bf8e 编写于 作者: J jiangbo

jiangbo91@huawei.com

add local_storage
Signed-off-by: Njiangbo <jiangbo91@huawei.com>
Change-Id: I7a350c2c58e00371dfef617eade74b92a4549caf
上级 f3a44851
......@@ -58,19 +58,19 @@ export default class MainAbility extends Ability {
console.log("[Demo MainAbility onDestroy]")
}
onWindowStageCreate(windowStage) {
// Main window is created,set main page for this ability
// Main window is created,set main page for this ability
windowStage.setUlContent(this.context,"pages/index",this.storage)
}
onWindowStageDestroy() {
// Main window is destroyed,release Ul related resources
// Main window is destroyed,release Ul related resources
console.log("[Demo] MainAbility onWindoeStageDestroy")
}
onForeground() {
// Ability has brought to foreground
// Ability has brought to foreground
console.log("[Demo] MainAbility onForeground")
}
onBackground() {
// Ability has back to background
// Ability has back to background
console.log("[Demo] MainAbility onBackground")
}}
```
......@@ -102,15 +102,16 @@ struct LocalStorageComponent {
```
let storage = new LocalStorage({"PropA":47});
@Entry(storage)
@Componentstruct ComA {
@Componentstruct
struct ComA {
@LocalStorageLink("PropA") storLink : number = 1;
build() {
Column() {
Text(`Parent from LocalStorage $(this.storLink)`)
.onClick(()=>this.storLink+=1)
Text(`Parent from LocalStorage $(this.storLink)`) .onClick(()=>this.storLink+=1)
Child()
}
}}
}
}
@Component
......@@ -119,5 +120,6 @@ struct Child{
build() {
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.
先完成此消息的编辑!
想要评论请 注册