提交 8e08046a 编写于 作者: B bojiang

jiangbo91@huawei.com

localStorage文档部分说明修改
Signed-off-by: Nbojiang <jiangbo91@huawei.com>
Change-Id: I7ef25ed6eade446d2558cf25ee29c7c1f33cb693
上级 477ba986
...@@ -143,12 +143,28 @@ struct LocalStorageComponent { ...@@ -143,12 +143,28 @@ struct LocalStorageComponent {
@LocalStorageLink("storageSimpleProp") simpleVarName: number = 0 @LocalStorageLink("storageSimpleProp") simpleVarName: number = 0
build() { build() {
Column(){ Column(){
Text(this.simpleVarName.toString()) Button(`LocalStorageLink: ${ this.simpleVarName.toString() }`)
.onClick(()=>{ .onClick(()=>{
this.simpleVarName +=1; this.simpleVarName +=1;
}) })
Text(JSON.stringify(this.simpleVarName)) Text(JSON.stringify(this.simpleVarName))
.fontSize(50) .fontSize(50)
LocalStorageComponentProp({ simpleVarName: $simpleVarName })
}
.height(500)
}
}
@Component
struct LocalStorageComponentProp {
@LocalStorageProp("storageSimpleProp") simpleVarName: number = 0
build() {
Column() {
Button(`LocalStorageProp: ${ this.simpleVarName.toString() }`)
.onClick(() => {
this.simpleVarName += 1;
})
Text(JSON.stringify(this.simpleVarName))
.fontSize(50)
} }
.height(500) .height(500)
} }
......
...@@ -401,7 +401,7 @@ setOrCreate\<T>(propName: string, newValue: T): boolean ...@@ -401,7 +401,7 @@ setOrCreate\<T>(propName: string, newValue: T): boolean
| 类型 | 描述 | | 类型 | 描述 |
| ------- | ------------------------------------------------------------ | | ------- | ------------------------------------------------------------ |
| boolean | 如果已存在与给定键名字相同的属性,更新其值且返回true。如果不存在具有给定名称的属性,在LocalStorage中创建具有给定默认值的新属性,默认值必须是T类型。不允许undefined 或 null 返回true。 | | boolean | 如果已存在与给定键名字相同的属性,更新其值且返回true。如果不存在具有给定名称的属性,在LocalStorage中创建具有给定默认值的新属性,默认值必须是T类型。不允许undefined 或 null 。 |
```ts ```ts
this.storage = new LocalStorage(); this.storage = new LocalStorage();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册