提交 79ad9fa3 编写于 作者: E ester.zhou

update doc (9007)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 0a492105
...@@ -50,7 +50,7 @@ struct SizeExample { ...@@ -50,7 +50,7 @@ struct SizeExample {
Text('layoutWeight(1)') Text('layoutWeight(1)')
.size({ width: '30%', height: 110 }).backgroundColor(0xFFEFD5).textAlign(TextAlign.Center) .size({ width: '30%', height: 110 }).backgroundColor(0xFFEFD5).textAlign(TextAlign.Center)
.layoutWeight(1) .layoutWeight(1)
// Weight 0 // Weight 2
Text('layoutWeight(2)') Text('layoutWeight(2)')
.size({ width: '30%', height: 110 }).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) .size({ width: '30%', height: 110 }).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
.layoutWeight(2) .layoutWeight(2)
......
...@@ -173,9 +173,9 @@ Establishes two-way data binding between an attribute and this **LocalStorage** ...@@ -173,9 +173,9 @@ Establishes two-way data binding between an attribute and this **LocalStorage**
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------- | ---------------------------------------- | | ------------------------------------ | ------------------------------------------------------------ |
| [@Link](ts-component-states-link.md ) | Returns the value corresponding to the specified key if the key is stored in the **LocalStorage**; creates and returns a **Link** instance with the specified value as its default value otherwise| | [@Link](ts-component-states-link.md) | Returns the value corresponding to the specified key if the key is stored in the **LocalStorage**; creates and returns a **Link** instance with the specified value as its default value otherwise.|
...@@ -195,7 +195,7 @@ Establishes one-way data binding with an attribute to update its status. ...@@ -195,7 +195,7 @@ Establishes one-way data binding with an attribute to update its status.
| Type | Description | | Type | Description |
| ------------------------------------ | ---------------------------------------- | | ------------------------------------ | ---------------------------------------- |
| [@Prop](ts-component-states-prop.md) | Returns one-way binding to an attribute with a given key if the attribute exists; returns **undefined** otherwise. This means that attribute changes made through the **LocalStorage** will be synchronized to the variable or component, but attribute changes made by the variable or component will be synchronized to the **LocalStorage**. Note that the variables returned are immutable variables, which are applicable to mutable and immutable state variables. | | [@Prop](ts-component-states-prop.md) | Returns one-way binding to an attribute with a given key if the attribute exists; returns **undefined** otherwise. This means that attribute changes made through the **LocalStorage** will be synchronized to the variable or component, but attribute changes made by the variable or component will not be synchronized to the **LocalStorage**. Note that the variables returned are immutable variables, which are applicable to mutable and immutable state variables. |
...@@ -286,20 +286,19 @@ Deletes all attributes. ...@@ -286,20 +286,19 @@ Deletes all attributes.
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
storage : LocalStorage storage : LocalStorage
onCreate(want) { onCreate() {
this.storage = new LocalStorage(); this.storage = new LocalStorage();
this.storage.setOrCreate("storageSimpleProp",121); this.storage.setOrCreate("storageSimpleProp",121);
console.log("[Demo MainAbility onCreate]"); console.log("[Demo MainAbility onCreate]");
globalThis.abilityWant = want;
} }
onDestroy() { onDestroy() {
console.log("[Demo MainAbility onDestroy]") console.log("[Demo MainAbility onDestroy]")
} }
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
windowStage.setUIContent(this.context,"pages/index",this.storage) windowStage.loadContent("pages/index",this.storage)
} }
onWindowStageDestroy() { onWindowStageDestroy() {
console.log("[Demo] MainAbility onWindoeStageDestroy") console.log("[Demo] MainAbility onWindoeStageDestroy")
} }
onForeground() { onForeground() {
console.log("[Demo] MainAbility onForeground") console.log("[Demo] MainAbility onForeground")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册