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

!23671 对状态管理文档的修改:LocalStorage中@ProA的修改、大小驼峰的修改(挑单23667)

Merge pull request !23671 from WangYanchao0418/cherry-pick-1693549403
...@@ -198,12 +198,12 @@ storage['PropA'] = 47; ...@@ -198,12 +198,12 @@ storage['PropA'] = 47;
@Component @Component
struct Child { struct Child {
// @LocalStorageLink变量装饰器与LocalStorage中的'ProA'属性建立双向绑定 // @LocalStorageLink变量装饰器与LocalStorage中的'PropA'属性建立双向绑定
@LocalStorageLink('PropA') storLink2: number = 1; @LocalStorageLink('PropA') storLink2: number = 1;
build() { build() {
Button(`Child from LocalStorage ${this.storLink2}`) Button(`Child from LocalStorage ${this.storLink2}`)
// 更改将同步至LocalStorage中的'ProA'以及Parent.storLink1 // 更改将同步至LocalStorage中的'PropA'以及Parent.storLink1
.onClick(() => this.storLink2 += 1) .onClick(() => this.storLink2 += 1)
} }
} }
...@@ -211,7 +211,7 @@ struct Child { ...@@ -211,7 +211,7 @@ struct Child {
@Entry(storage) @Entry(storage)
@Component @Component
struct CompA { struct CompA {
// @LocalStorageLink变量装饰器与LocalStorage中的'ProA'属性建立双向绑定 // @LocalStorageLink变量装饰器与LocalStorage中的'PropA'属性建立双向绑定
@LocalStorageLink('PropA') storLink1: number = 1; @LocalStorageLink('PropA') storLink1: number = 1;
build() { build() {
...@@ -243,7 +243,7 @@ storage['PropA'] = 47; ...@@ -243,7 +243,7 @@ storage['PropA'] = 47;
@Entry(storage) @Entry(storage)
@Component @Component
struct CompA { struct CompA {
// @LocalStorageProp变量装饰器与LocalStorage中的'ProA'属性建立单向绑定 // @LocalStorageProp变量装饰器与LocalStorage中的'PropA'属性建立单向绑定
@LocalStorageProp('PropA') storProp1: number = 1; @LocalStorageProp('PropA') storProp1: number = 1;
build() { build() {
...@@ -258,7 +258,7 @@ struct CompA { ...@@ -258,7 +258,7 @@ struct CompA {
@Component @Component
struct Child { struct Child {
// @LocalStorageProp变量装饰器与LocalStorage中的'ProA'属性建立单向绑定 // @LocalStorageProp变量装饰器与LocalStorage中的'PropA'属性建立单向绑定
@LocalStorageProp('PropA') storProp2: number = 2; @LocalStorageProp('PropA') storProp2: number = 2;
build() { build() {
...@@ -410,12 +410,12 @@ export default class EntryAbility extends UIAbility { ...@@ -410,12 +410,12 @@ export default class EntryAbility extends UIAbility {
} }
``` ```
在UI页面通过GetShared接口获取在通过loadContent共享的LocalStorage实例。 在UI页面通过getShared接口获取在通过loadContent共享的LocalStorage实例。
```ts ```ts
// 通过GetShared接口获取stage共享的LocalStorage实例 // 通过getShared接口获取stage共享的LocalStorage实例
let storage = LocalStorage.GetShared() let storage = LocalStorage.getShared()
@Entry(storage) @Entry(storage)
@Component @Component
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册