未验证 提交 e7d4cb63 编写于 作者: O openharmony_ci 提交者: Gitee

!9007 loaclStorage示例代码接口修改

Merge pull request !9007 from Bo Jiang/master
......@@ -169,9 +169,9 @@ setAndLink\<T>(propName: string, defaultValue: T): T
**返回值:**
| 类型 | 描述 |
| ------------------------------------- | ---------------------------------------- |
| [@Link](ts-component-states-link.md ) | 与Link接口类似,如果当前的key保存于LocalStorage,返回该key值对应的value值。如果该key值未被创建,则创建一个对应的defaultValue的Link返回。 |
| 类型 | 描述 |
| ------------------------------------ | ------------------------------------------------------------ |
| [@Link](ts-component-states-link.md) | 与Link接口类似,如果当前的key保存于LocalStorage,返回该key值对应的value值。如果该key值未被创建,则创建一个对应的defaultValue的Link返回。 |
......@@ -282,20 +282,19 @@ clear(): boolean
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
storage : LocalStorage
onCreate(want) {
onCreate() {
this.storage = new LocalStorage();
this.storage.setOrCreate("storageSimpleProp",121);
console.log("[Demo MainAbility onCreate]");
globalThis.abilityWant = want;
console.log("[Demo MainAbility onCreate]");
}
onDestroy() {
console.log("[Demo MainAbility onDestroy]")
}
onWindowStageCreate(windowStage) {
windowStage.setUIContent(this.context,"pages/index",this.storage)
windowStage.loadContent("pages/index",this.storage)
}
onWindowStageDestroy() {
console.log("[Demo] MainAbility onWindoeStageDestroy")
console.log("[Demo] MainAbility onWindoeStageDestroy")
}
onForeground() {
console.log("[Demo] MainAbility onForeground")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册