提交 ef3033cc 编写于 作者: B bojiang

jiangbo91@huawei.com

localstorage示例代码修改
Signed-off-by: Nbojiang <jiangbo91@huawei.com>
Change-Id: I81e9f0b68fd899ccdf074ff6b1e76b10441c8082
上级 c2f0d634
......@@ -279,7 +279,7 @@ clear(): boolean
### 示例1(在一个Ability创建的LocalStorage)
```javascript
import Ability from '@ohos.appLication.Ability'
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
storage : LocalStorage
onCreate(want) {
......@@ -335,23 +335,23 @@ let storage = new LocalStorage({"PropA":47});
@Entry(storage)
@Component
struct ComA {
@LocalStorageLink("PropA") storLink : number = 1;
@LocalStorageLink("PropA") storLink: number = 1;
build() {
Column() {
Text(`Parent from LocalStorage $(this.storLink)`)
Text(`Parent from LocalStorage ${ this.storLink }`)
.onClick(()=>this.storLink+=1)
Child()
}
Child()
}
}
}
@Component
struct Child{
@LocalStorageLink("PropA") storLink : number = 1;
@LocalStorageLink("PropA") storLink: number = 1;
build() {
Text(`Parent from LocalStorage $(this.storLink)`)
.onClick(()=>this.storLink1+=1)
Text(`Parent from LocalStorage ${ this.storLink }`)
.onClick(()=>this.storLink+=1)
}
}
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册