@@ -81,21 +81,22 @@
```
- 单复数格式化方法
- **表3** 单复数格式化
-
- | 属性 | 类型 | 参数 | 必填 | 描述 |
- | -------- | -------- | -------- | -------- | -------- |
- | $tc | Function | 请见$tc参数说明 | 是 | 根据系统语言完成单复数替换:this.$tc('strings.plurals')
定义资源的内容通过json格式的key为“zero”、“one”、“two”、“few”、“many”和“other”区分。 |
-
- **表4** $tc参数说明
-
- | 参数 | 类型 | 必填 | 描述 |
- | -------- | -------- | -------- | -------- |
- | path | string | 是 | 资源路径 |
- | count | number | 是 | 要表达的值 |
+
+ **表3** 单复数格式化
+
+ | 属性 | 类型 | 参数 | 必填 | 描述 |
+ | ---- | -------- | --------- | ---- | ---------------------------------------- |
+ | $tc | Function | 请见$tc参数说明 | 是 | 根据系统语言完成单复数替换:this.$tc('strings.plurals')
定义资源的内容通过json格式的key为“zero”、“one”、“two”、“few”、“many”和“other”区分。 |
+
+ **表4** $tc参数说明
+
+ | 参数 | 类型 | 必填 | 描述 |
+ | ----- | ------ | ---- | ----- |
+ | path | string | 是 | 资源路径 |
+ | count | number | 是 | 要表达的值 |
- 单复数格式化示例代码
-
+
```html
diff --git a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-syntax-hml.md b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-syntax-hml.md
index 3270a6fd6a9ed892a310406e55067adc81639505..7d503c6fe8b401e1237bcdd6346cf8cb48801fd5 100644
--- a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-syntax-hml.md
+++ b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-syntax-hml.md
@@ -35,7 +35,6 @@ HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组
```json
-// xxx.json
{
"data": {
"content": "Hello World!",
@@ -49,9 +48,9 @@ HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组
> **说明:**
-> - key值支持对象操作符和数组操作符,如{{key.value}}、{{key[0]}}。
->
-> - 从 API Version 6 开始支持字符串拼接、逻辑运算和三元表达式。
+> - key值支持对象操作符和数组操作符,如{{key.value}}、{{key[0]}}。
+>
+> - 从 API Version 6 开始支持字符串拼接、逻辑运算和三元表达式。
> - 字符串拼接:
> - 支持变量跟变量:{{key1}}{{key2}}等
> - 支持常量跟变量: "my name is {{name}}, i am from {{city}}." "key1 {{key1}}"
@@ -70,18 +69,17 @@ HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组
卡片仅支持click通用事件,事件的定义只能是直接命令式,事件定义必须包含action字段,用以说明事件类型。卡片支持两种事件类型:跳转事件(router)和消息事件(message)。跳转事件可以跳转到卡片提供方的OpenHarmony应用,消息事件可以将开发者自定义信息传递给卡片提供方。事件参数支持变量,变量以"{{}}"修饰。跳转事件中若定义了params字段,则在被拉起应用的onStart的intent中,可用"params"作为key将跳转事件定义的params字段的值取到。
- 跳转事件格式
-
+
通过定义ability名称和携带的参数字段params直接跳转,可用"params"作为key提取到跳转事件定义的params字段值。
-
- | 选择器 | 样例 | 默认值 | 样例描述 |
- | -------- | -------- | -------- | -------- |
- | action | string | "router" | 事件类型。
- "router":用于应用跳转。
- "message":自定义点击事件。 |
- | abilityName | string | - | 跳转ability名。 |
- | params | Object | - | 跳转应用携带的额外参数。 |
-
-
+
+ | 选择器 | 样例 | 默认值 | 样例描述 |
+ | ----------- | ------ | -------- | ---------------------------------------- |
+ | action | string | "router" | 事件类型。
- "router":用于应用跳转。
- "message":自定义点击事件。 |
+ | abilityName | string | - | 跳转ability名。 |
+ | params | Object | - | 跳转应用携带的额外参数。 |
+
+
```json
- // xxx.json
{
"data": {
"mainAbility": "xxx.xxx.xxx"
@@ -95,30 +93,29 @@ HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组
}
}
```
-
+
也可以使用want格式绑定参数跳转到目标应用,want定义了ability名称、包名、携带的参数字段等。
-
- | 选择器 | 类型 | 默认值 | 样例描述 |
- | ------ | ------ | -------- | ------------------------------------------------------------ |
+
+ | 选择器 | 类型 | 默认值 | 样例描述 |
+ | ------ | ------ | -------- | ---------------------------------------- |
| action | string | "router" | 事件类型。
- "router":用于应用跳转。
- "message":自定义点击事件。 |
- | want | Object | - | 跳转目标应用的信息,参考want格式表。 |
-
+ | want | Object | - | 跳转目标应用的信息,参考want格式表。 |
+
**表1** want格式
-
- | 选择器 | 类型 | 默认值 | 样例描述 |
- | ----------- | -------------------- | ------------ | ------------------------------------------------------------ |
+
+ | 选择器 | 类型 | 默认值 | 样例描述 |
+ | ----------- | -------------------- | ------------ | ---------------------------------------- |
| bundleName | string | - | 表示包描述。如果在Want中同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。 |
- | abilityName | string | - | 表示待启动的Ability名称。 |
- | action | string | - | 表示action选项描述。 |
+ | abilityName | string | - | 表示待启动的Ability名称。 |
+ | action | string | - | 表示action选项描述。 |
| uri | string | - | 表示Uri描述。如果在Want中指定了Uri,则Want将匹配指定的Uri信息,包括scheme, schemeSpecificPart, authority和path信息。 |
- | type | string | "text/plain" | 表示MIME type类型描述,比如:"text/plain" 、 "image/*"等。 |
+ | type | string | "text/plain" | 表示MIME type类型描述,比如:"text/plain" 、 "image/*"等。 |
| flags | number | - | 表示处理Want的方式。默认传数字,具体参考[flags说明](../apis/js-apis-featureAbility.md#flags说明)。 |
- | entities | Array\
| - | 类别,用于指定Intent的操作类别。 |
- | parameters | {[key: string]: any} | - | 表示WantParams描述。 |
-
-
+ | entities | Array\ | - | 类别,用于指定Intent的操作类别。 |
+ | parameters | {[key: string]: any} | - | 表示WantParams描述。 |
+
+
```json
- // xxx.json
{
"data": {
"mainAbility": "xxx.xxx.xxx"
@@ -141,19 +138,18 @@ HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组
}
}
```
-
+
在API Version 8,want参数需要在app.js或app.ets文件的onCreate方法中调用[featureAbility.getWant](../apis/js-apis-featureAbility.md#featureabilitygetwant-1)接口接收相关参数。
-
+
- 消息事件格式
- | 选择器 | 样例 | 默认值 | 样例描述 |
- | -------- | -------- | -------- | -------- |
- | action | string | message | 表示事件类型。 |
- | params | Object | - | 跳转应用携带的额外参数。 |
+ | 选择器 | 样例 | 默认值 | 样例描述 |
+ | ------ | ------ | ------- | ------------ |
+ | action | string | message | 表示事件类型。 |
+ | params | Object | - | 跳转应用携带的额外参数。 |
+
-
```json
- // xxx.json
{
"actions": {
"activeEvent": {
@@ -165,7 +161,7 @@ HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组
```
- 绑定路由事件和消息事件
-
+
```html
@@ -201,7 +197,6 @@ HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组
```json
-// xxx.json
{
"data": {
"array": [
@@ -221,15 +216,15 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
- for="(i, v) in array":其中元素索引为i,元素变量为v,遍历数组对象array。
> **说明:**
-> - 数组中的每个元素必须存在tid指定的数据属性,否则运行时可能会导致异常。
->
-> - 数组中被tid指定的属性要保证唯一性,如果不是则会造成性能损耗。比如,示例中只有id和name可以作为tid字段,因为它们属于唯一字段。
->
-> - tid不支持表达式。
->
-> - 不支持for嵌套使用。
->
-> - for对应的变量数组,当前要求数组中的object是相同类型,不支持多种object类型混合写在一个数组中。
+> - 数组中的每个元素必须存在tid指定的数据属性,否则运行时可能会导致异常。
+>
+> - 数组中被tid指定的属性要保证唯一性,如果不是则会造成性能损耗。比如,示例中只有id和name可以作为tid字段,因为它们属于唯一字段。
+>
+> - tid不支持表达式。
+>
+> - 不支持for嵌套使用。
+>
+> - for对应的变量数组,当前要求数组中的object是相同类型,不支持多种object类型混合写在一个数组中。
## 条件渲染
@@ -250,7 +245,6 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
```json
-// xxx.json
{
"data": {
"show": false,
@@ -269,7 +263,6 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
```json
-// xxx.json
{
"data": {
"visible": false
@@ -295,7 +288,6 @@ tid属性主要用来加速for循环的重渲染,旨在列表中的数据有
```json
-// xxx.json
{
"data": {
"show": true
diff --git a/zh-cn/application-dev/ui/ui-ts-basic-components-button.md b/zh-cn/application-dev/ui/ui-ts-basic-components-button.md
index 9983e643f1015dd8e4ecf4fe1449c6876b191565..0dc0a694eaabd74c8e726c90834c37ca59f368ea 100644
--- a/zh-cn/application-dev/ui/ui-ts-basic-components-button.md
+++ b/zh-cn/application-dev/ui/ui-ts-basic-components-button.md
@@ -167,26 +167,26 @@ Button('Ok', { type: ButtonType.Normal, stateEffect: true })
```
- 
+ 
- 用于表单的提交
在用户登录/注册页面,用户的登录或注册的提交操作会用按钮。
-
```ts
-// xxx.js
-@Entry
- @Component
- struct ButtonCase2 {
- build() {
- Column() {
- TextInput({ placeholder: 'input your username' }).margin({ top: 20 })
- TextInput({ placeholder: 'input your password' }).type(InputType.Password).margin({ top: 20 })
- Button('Register').width(300).margin({ top: 20 })
- }.padding(20)
+ // xxx.js
+ @Entry
+ @Component
+ struct ButtonCase2 {
+ build() {
+ Column() {
+ TextInput({ placeholder: 'input your username' }).margin({ top: 20 })
+ TextInput({ placeholder: 'input your password' }).type(InputType.Password).margin({ top: 20 })
+ Button('Register').width(300).margin({ top: 20 })
+ }.padding(20)
+ }
}
- }
```
- 
+
+ 