提交 fd9d4215 编写于 作者: C cc_ggboy

Merge branch 'master' of https://gitee.com/cc_ggboy/docs

...@@ -779,7 +779,9 @@ interface Employee extends Identity, Contact {} ...@@ -779,7 +779,9 @@ interface Employee extends Identity, Contact {}
**Severity: error** **Severity: error**
ArkTS does not support the returning `this` type. Use explicit type instead. ArkTS does not support type notation using the `this` keyword (for example,
specifying a method's return type `this` is not allowed). Use explicit type
instead.
**TypeScript** **TypeScript**
...@@ -959,7 +961,9 @@ type N = number ...@@ -959,7 +961,9 @@ type N = number
**Severity: error** **Severity: error**
ArkTS does not support indexed access for class fields. Use dot notation ArkTS does not support indexed access for class fields. Use dot notation
instead. instead. An exception are all typed arrays from the standard library
(for example, `Int32Array`), which support access to their elements through
`container[index]` syntax.
**TypeScript** **TypeScript**
...@@ -975,6 +979,9 @@ let x = p["x"] ...@@ -975,6 +979,9 @@ let x = p["x"]
class Point {x: number = 0; y: number = 0} class Point {x: number = 0; y: number = 0}
let p: Point = {x: 1, y: 2} let p: Point = {x: 1, y: 2}
let x = p.x let x = p.x
let arr = new Int32Array(1)
console.log(arr[0])
``` ```
## Recipe: Structural identity is not supported ## Recipe: Structural identity is not supported
...@@ -1541,33 +1548,6 @@ let a2: C[] = [{n: 1, s: "1"}, {n: 2, s : "2"}] // ditto ...@@ -1541,33 +1548,6 @@ let a2: C[] = [{n: 1, s: "1"}, {n: 2, s : "2"}] // ditto
* Recipe: Object literal must correspond to some explicitly declared class or interface * Recipe: Object literal must correspond to some explicitly declared class or interface
* Recipe: Object literals cannot be used as type declarations * Recipe: Object literals cannot be used as type declarations
## Recipe: Lambdas require explicit type annotation for parameters
**Rule `arkts-explicit-param-types-in-lambdas`**
**Severity: error**
Currently, ArkTS requires the types of lambda parameters
to be explicitly specified.
**TypeScript**
```typescript
// Compile-time error only with noImplicitAny:
let f = (s /* type any is assumed */) => {
console.log(s)
}
```
**ArkTS**
```typescript
// Explicit types for lambda parameters are mandatory:
let f = (s: string) => {
console.log(s)
}
```
## Recipe: Use arrow functions instead of function expressions ## Recipe: Use arrow functions instead of function expressions
**Rule `arkts-no-func-expressions`** **Rule `arkts-no-func-expressions`**
...@@ -1989,9 +1969,9 @@ let f = "string" + true // "stringtrue" ...@@ -1989,9 +1969,9 @@ let f = "string" + true // "stringtrue"
let g = (new Object()) + "string" // "[object Object]string" let g = (new Object()) + "string" // "[object Object]string"
let i = true + true // JS: 2, TS: compile-time error let i = true + true // compile-time error
let j = true + 2 // JS: 3, TS: compile-time error let j = true + 2 // compile-time error
let k = E.E1 + true // JS: 1, TS: compile-time error let k = E.E1 + true // compile-time error
``` ```
**ArkTS** **ArkTS**
...@@ -2011,7 +1991,7 @@ let g = (new Object()).toString() + "string" ...@@ -2011,7 +1991,7 @@ let g = (new Object()).toString() + "string"
let i = true + true // compile-time error let i = true + true // compile-time error
let j = true + 2 // compile-time error let j = true + 2 // compile-time error
let k = E.E1 + true // compile-time error let k = E.E1 + true // compile-time error
``` ```
...@@ -2341,7 +2321,8 @@ iterate over data. ...@@ -2341,7 +2321,8 @@ iterate over data.
**Severity: error** **Severity: error**
ArkTS supports the iteration over arrays and strings by the `for .. of` loop, ArkTS supports the iteration over arrays and strings by the `for .. of` loop,
but does not support the iteration of objects content. but does not support the iteration of objects content. All typed arrays from
the standard library (for example, `Int32Array`) are also supported.
**TypeScript** **TypeScript**
...@@ -2433,7 +2414,8 @@ console.log("Area: ", Math.PI * r * r) ...@@ -2433,7 +2414,8 @@ console.log("Area: ", Math.PI * r * r)
**Severity: error** **Severity: error**
ArkTS supports `case` statements that contain only compile-time values. ArkTS supports `case` statements that contain only compile-time values,
top-level scope `const` values, and `static readonly` class fields.
Use `if` statements as an alternative. Use `if` statements as an alternative.
**TypeScript** **TypeScript**
...@@ -2907,7 +2889,8 @@ function main(): void { ...@@ -2907,7 +2889,8 @@ function main(): void {
The only supported scenario for the spread operator is to spread an array into The only supported scenario for the spread operator is to spread an array into
the rest parameter. Otherwise, manually “unpack” data from arrays and objects, the rest parameter. Otherwise, manually “unpack” data from arrays and objects,
where necessary. where necessary. All typed arrays from the standard library (for example,
`Int32Array`) are also supported.
**TypeScript** **TypeScript**
...@@ -3880,34 +3863,6 @@ let ce = new CustomError() ...@@ -3880,34 +3863,6 @@ let ce = new CustomError()
* Recipe: Prototype assignment is not supported * Recipe: Prototype assignment is not supported
## Recipe: Runtime import expressions are not supported
**Rule `arkts-no-runtime-import`**
**Severity: error**
ArkTS does not support such “runtime” import expressions as `await import...`
because in the language import is a compile-time, not a runtime feature.
Use regular import syntax instead.
**TypeScript**
```typescript
const zipUtil = await import("utils/create-zip-file")
```
**ArkTS**
```typescript
import { zipUtil } from "utils/create-zip-file"
```
**See also**
* Recipe: Wildcards in module names are not supported
* Recipe: Universal module definitions (UMD) are not supported
* Recipe: Import assertions are not supported
## Recipe: Definite assignment assertions are not supported ## Recipe: Definite assignment assertions are not supported
**Rule `arkts-no-definite-assignment`** **Rule `arkts-no-definite-assignment`**
...@@ -4065,8 +4020,7 @@ M.abc = 200 ...@@ -4065,8 +4020,7 @@ M.abc = 200
**Severity: error** **Severity: error**
Currently ArkTS does not support utility types from TypeScript extensions to the Currently ArkTS does not support utility types from TypeScript extensions to the
standard library (`Omit`, `Pick`, etc.). Exceptions are: `Partial`, standard library, except following: `Partial`, `Record`.
`Record`.
For the type *Record<K, V>*, the type of an indexing expression *rec[index]* is For the type *Record<K, V>*, the type of an indexing expression *rec[index]* is
of the type *V | undefined*. of the type *V | undefined*.
...@@ -4349,7 +4303,6 @@ import { something } from "module" ...@@ -4349,7 +4303,6 @@ import { something } from "module"
* Recipe: Wildcards in module names are not supported * Recipe: Wildcards in module names are not supported
* Recipe: Universal module definitions (UMD) are not supported * Recipe: Universal module definitions (UMD) are not supported
* Recipe: Runtime import expressions are not supported
## Recipe: Usage of standard library is restricted ## Recipe: Usage of standard library is restricted
...@@ -4364,9 +4317,7 @@ the following APIs is prohibited: ...@@ -4364,9 +4317,7 @@ the following APIs is prohibited:
Properties and functions of the global object: `eval`, Properties and functions of the global object: `eval`,
`Infinity`, `NaN`, `isFinite`, `isNaN`, `parseFloat`, `parseInt`, `Infinity`, `NaN`, `isFinite`, `isNaN`, `parseFloat`, `parseInt`,
`encodeURI`, `encodeURIComponent`, `Encode`, `Encode`, `Decode`, `ParseHexOctet`
`decodeURI`, `decodeURIComponent`, `Decode`,
`escape`, `unescape`, `ParseHexOctet`
`Object`: `__proto__`, `__defineGetter__`, `__defineSetter__`, `Object`: `__proto__`, `__defineGetter__`, `__defineSetter__`,
`__lookupGetter__`, `__lookupSetter__`, `assign`, `create`, `__lookupGetter__`, `__lookupSetter__`, `assign`, `create`,
...@@ -4561,3 +4512,54 @@ class BugReport { ...@@ -4561,3 +4512,54 @@ class BugReport {
} }
``` ```
## Recipe: Classes cannot be used as objects
**Rule `arkts-no-classes-as-obj`**
**Severity: error**
ArkTS does not support using classes as objects (assigning them to variables,
etc.) because in ArkTS, a `class` declaration introduces a new type,
not a value.
**TypeScript**
```typescript
class C {
s: string = ""
n: number = 0
}
let c = C
```
## Recipe: `import` statements after other statements are not allowed
**Rule `arkts-no-misplaced-imports`**
**Severity: error**
In ArkTS, all `import` statements should go before all other statements
in the program.
**TypeScript**
```typescript
class C {
s: string = ""
n: number = 0
}
import foo from "module1"
```
**ArkTS**
```typescript
import foo from "module1"
class C {
s: string = ""
n: number = 0
}
```
...@@ -35,7 +35,7 @@ OpenHarmony提供了一套UI开发框架,即方舟开发框架(ArkUI框架 ...@@ -35,7 +35,7 @@ OpenHarmony提供了一套UI开发框架,即方舟开发框架(ArkUI框架
FA模型和Stage模型的整体架构和设计思想等更多区别,请见[应用模型解读](../application-models/application-model-description.md) FA模型和Stage模型的整体架构和设计思想等更多区别,请见[应用模型解读](../application-models/application-model-description.md)
快速入门提供了一个含有两个页面的开发实例,并使用了不同的开发语言或不同的应用模型进行开发,以便开发者理解以上基本概念及应用开发流程。 快速入门提供了一个含有两个页面的开发实例,并基于Stage模型构建第一个ArkTS应用,以便开发者理解以上基本概念及应用开发流程。
## 工具准备 ## 工具准备
......
...@@ -837,6 +837,7 @@ type N = number ...@@ -837,6 +837,7 @@ type N = number
**级别:错误** **级别:错误**
ArkTS不支持通过索引访问对象的字段。改用点操作符。 ArkTS不支持通过索引访问对象的字段。改用点操作符。
ArkTS支持通过索引访问`TypedArray`(例如`Int32Array`)中的元素。
**TypeScript** **TypeScript**
...@@ -852,6 +853,9 @@ let x = p["x"] ...@@ -852,6 +853,9 @@ let x = p["x"]
class Point {x: number = 0; y: number = 0} class Point {x: number = 0; y: number = 0}
let p: Point = {x: 1, y: 2} let p: Point = {x: 1, y: 2}
let x = p.x let x = p.x
let arr = new Int32Array(1)
console.log(arr[0])
``` ```
### 不支持structural identity ### 不支持structural identity
...@@ -1305,7 +1309,7 @@ class Point { ...@@ -1305,7 +1309,7 @@ class Point {
y: number = 0 y: number = 0
// 在字面量初始化之前,使用constructor()创建一个有效对象。 // 在字面量初始化之前,使用constructor()创建一个有效对象。
// 由于Point没有其它构造函数,编译器将自动添加一个默认构造函数。 // 由于没有为Point定义构造函数,编译器将自动添加一个默认构造函数。
} }
function id_x_y(o: Point): Point { function id_x_y(o: Point): Point {
...@@ -1392,32 +1396,6 @@ let a2: C[] = [{n: 1, s: "1"}, {n: 2, s : "2"}] // a2的类型为“C[]” ...@@ -1392,32 +1396,6 @@ let a2: C[] = [{n: 1, s: "1"}, {n: 2, s : "2"}] // a2的类型为“C[]”
* 对象字面量必须对应某些显式声明的类或接口 * 对象字面量必须对应某些显式声明的类或接口
* 对象字面量不能用于类型声明 * 对象字面量不能用于类型声明
### 显式标注Lambda函数的参数类型
**规则:**`arkts-explicit-param-types-in-lambdas`
**级别:错误**
当前ArkTS要求显式标注lambda函数的参数的类型。
**TypeScript**
```typescript
// 只有在开启noImplicitAny选项时会产生编译时错误
let f = (s /* type any is assumed */) => {
console.log(s)
}
```
**ArkTS**
```typescript
// 显式标注Lambda函数的参数类型
let f = (s: string) => {
console.log(s)
}
```
### 使用箭头函数而非函数表达式 ### 使用箭头函数而非函数表达式
**规则:**`arkts-no-func-expressions` **规则:**`arkts-no-func-expressions`
...@@ -1814,9 +1792,9 @@ let f = "string" + true // "stringtrue" ...@@ -1814,9 +1792,9 @@ let f = "string" + true // "stringtrue"
let g = (new Object()) + "string" // "[object Object]string" let g = (new Object()) + "string" // "[object Object]string"
let i = true + true // JS: 2, TS: 编译时错误 let i = true + true // 编译时错误
let j = true + 2 // JS: 3, TS: 编译时错误 let j = true + 2 // 编译时错误
let k = E.E1 + true // JS: 1, TS: 编译时错误 let k = E.E1 + true // 编译时错误
``` ```
**ArkTS** **ArkTS**
...@@ -1835,7 +1813,7 @@ let f = "string" + true // "stringtrue" ...@@ -1835,7 +1813,7 @@ let f = "string" + true // "stringtrue"
let g = (new Object()).toString() + "string" let g = (new Object()).toString() + "string"
let i = true + true // 编译时错误 let i = true + true // 编译时错误
let j = true + 2 // 编译时错误 let j = true + 2 // 编译时错误
let k = E.E1 + true // 编译时错误 let k = E.E1 + true // 编译时错误
``` ```
...@@ -2142,7 +2120,7 @@ ArkTS不支持`Symbol`API、`Symbol.iterator`和最终可迭代的接口。请 ...@@ -2142,7 +2120,7 @@ ArkTS不支持`Symbol`API、`Symbol.iterator`和最终可迭代的接口。请
**级别:错误** **级别:错误**
ArkTS支持通过`for .. of`迭代数组和字符串,但不支持迭代对象。 ArkTS支持通过`for .. of`迭代数组、字符串和`TypedArray`(例如`Int32Array`,但不支持迭代对象。
**TypeScript** **TypeScript**
...@@ -2232,7 +2210,7 @@ console.log("Area: ", Math.PI * r * r) ...@@ -2232,7 +2210,7 @@ console.log("Area: ", Math.PI * r * r)
**级别:错误** **级别:错误**
在ArkTS中,`case`语句仅支持编译期值。若值无法在编译期确定,请使用`if`语句。 在ArkTS中,`case`语句仅支持编译期值,支持`const`常量和`class``static readonly`属性。若值无法在编译期确定,请使用`if`语句。
**TypeScript** **TypeScript**
...@@ -2689,7 +2667,7 @@ function main(): void { ...@@ -2689,7 +2667,7 @@ function main(): void {
**级别:错误** **级别:错误**
展开运算符唯一支持的场景是函数剩余参数为数组类型。 展开运算符唯一支持的场景是函数剩余参数为数组类型,包括`TypedArray`(例如`Int32Array`
**TypeScript** **TypeScript**
...@@ -3273,7 +3251,7 @@ import "path/to/module" ...@@ -3273,7 +3251,7 @@ import "path/to/module"
**ArkTS** **ArkTS**
```typescript ```typescript
import * from "path/to/module" import * as ns from "path/to/module"
``` ```
### 不支持`import default as ...` ### 不支持`import default as ...`
...@@ -3326,7 +3304,7 @@ import * as m from "mod" ...@@ -3326,7 +3304,7 @@ import * as m from "mod"
**级别:错误** **级别:错误**
ArkTS支持大多数场景下的重导出,比如命名导出和重命名导出,重导出import的。不支持`export * as ...` ArkTS支持大多数场景下的重导出,例如命名重导出和重命名重导出。不支持`export * as ...`
**TypeScript** **TypeScript**
...@@ -3512,7 +3490,7 @@ declare namespace N { ...@@ -3512,7 +3490,7 @@ declare namespace N {
function foo(x: number): number function foo(x: number): number
} }
import * from "module" import * as m from "module"
console.log("N.foo called: ", N.foo(42)) console.log("N.foo called: ", N.foo(42))
``` ```
...@@ -3622,32 +3600,6 @@ let ce = new CustomError() ...@@ -3622,32 +3600,6 @@ let ce = new CustomError()
* 不支持在原型上赋值 * 不支持在原型上赋值
### 不支持动态导入
**规则:**`arkts-no-runtime-import`
**级别:错误**
由于在ArkTS中,导入是编译时而非运行时特性,因此,ArkTS不支持动态导入,如`await import...`。改用静态`import`语法。
**TypeScript**
```typescript
const zipUtil = await import("utils/create-zip-file")
```
**ArkTS**
```typescript
import { zipUtil } from "utils/create-zip-file"
```
**相关约束**
* 不支持在模块名中使用通配符
* 不支持通用模块定义(UMD)
* 不支持导入断言
### 不支持确定赋值断言 ### 不支持确定赋值断言
**规则:**`arkts-no-definite-assignment` **规则:**`arkts-no-definite-assignment`
...@@ -3796,7 +3748,7 @@ M.abc = 200 ...@@ -3796,7 +3748,7 @@ M.abc = 200
**级别:错误** **级别:错误**
当前ArkTS不支持从TypeScript扩展到标准库的utility类型(例如`Omit``Pick`等)。支持`Partial``Record` ArkTS仅支持`Partial``Record`,不支持TypeScript中其他的`Utility Types`
对于*Record<K, V>*类型,表达式*rec[index]*的类型是*V | undefined* 对于*Record<K, V>*类型,表达式*rec[index]*的类型是*V | undefined*
对于`Record`类型,键-值中的值的类型必须是可选类型或者包含`undefined`的联合类型。 对于`Record`类型,键-值中的值的类型必须是可选类型或者包含`undefined`的联合类型。
...@@ -4079,9 +4031,7 @@ ArkTS不允许使用TypeScript或JavaScript标准库中的某些接口。大部 ...@@ -4079,9 +4031,7 @@ ArkTS不允许使用TypeScript或JavaScript标准库中的某些接口。大部
全局对象的属性和方法:`eval` 全局对象的属性和方法:`eval`
`Infinity``NaN``isFinite``isNaN``parseFloat``parseInt` `Infinity``NaN``isFinite``isNaN``parseFloat``parseInt`
`encodeURI``encodeURIComponent``Encode` `Encode``Decode``ParseHexOctet`
`decodeURI``decodeURIComponent``Decode`
`escape``unescape``ParseHexOctet`
`Object``__proto__``__defineGetter__``__defineSetter__` `Object``__proto__``__defineGetter__``__defineSetter__`
`__lookupGetter__``__lookupSetter__``assign``create` `__lookupGetter__``__lookupSetter__``assign``create`
...@@ -4267,3 +4217,52 @@ function classDecorator(x: number, y: number): void { ...@@ -4267,3 +4217,52 @@ function classDecorator(x: number, y: number): void {
class BugReport { class BugReport {
} }
``` ```
### `class`不能被用作对象
**规则:**`arkts-no-classes-as-obj`
**级别:错误**
在ArkTS中,`class`声明的是一个新的类型,不是一个值。因此,不支持将`class`用作对象(例如将`class`赋值给一个对象)。
**TypeScript**
```typescript
class C {
s: string = ""
n: number = 0
}
let c = C
```
### 不支持在`import`语句前使用其他语句
**规则:**`arkts-no-misplaced-imports`
**级别:错误**
在ArkTS中,除动态`import`语句外,所有`import`语句需要放在所有其他语句之前。
**TypeScript**
```typescript
class C {
s: string = ""
n: number = 0
}
import foo from "module1"
```
**ArkTS**
```typescript
import foo from "module1"
class C {
s: string = ""
n: number = 0
}
```
...@@ -17,7 +17,7 @@ import { DrawableDescriptor, LayeredDrawableDescriptor } from '@ohos.arkui.drawa ...@@ -17,7 +17,7 @@ import { DrawableDescriptor, LayeredDrawableDescriptor } from '@ohos.arkui.drawa
## DrawableDescriptor.constructor ## DrawableDescriptor.constructor
constructor() constructor()
创建DrawableDescriptor或LayeredDrawableDescriptor对象。对象构造需要使用全球化接口[getDrawableDescriptor](js-apis-resource-manager.md##getdrawabledescriptor)[getDrawableDescriptorByName](js-apis-resource-manager.md##getdrawabledescriptorbyname) 创建DrawableDescriptor或LayeredDrawableDescriptor对象。对象构造需要使用全球化接口[getDrawableDescriptor](js-apis-resource-manager.md#getdrawabledescriptor)[getDrawableDescriptorByName](js-apis-resource-manager.md#getdrawabledescriptorbyname)
**系统接口:** 此接口为系统接口。 **系统接口:** 此接口为系统接口。
......
...@@ -108,8 +108,8 @@ start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCal ...@@ -108,8 +108,8 @@ start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCal
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 4400001 | 当调用键鼠穿越接口传入无效的设备描述符参数时,系统会产生此错误码。 | | 4400001 | Incorrect descriptor for the target device. |
| 4400002 | 当调用键鼠穿越接口时穿越状态异常,系统会产生此错误码。 | | 4400002 | Screen hop failed. |
**示例** **示例**
...@@ -158,8 +158,8 @@ start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise\<void> ...@@ -158,8 +158,8 @@ start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise\<void>
| 错误码ID | 错误信息 | | 错误码ID | 错误信息 |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 4400001 | 当调用键鼠穿越接口传入无效的设备描述符参数时,系统会产生此错误码。 | | 4400001 | Incorrect descriptor for the target device. |
| 4400002 | 当调用键鼠穿越接口时穿越状态异常,系统会产生此错误码。 | | 4400002 | Screen hop failed. |
**示例** **示例**
......
...@@ -3840,6 +3840,15 @@ assertComponentExist(by: By): Promise\<void> ...@@ -3840,6 +3840,15 @@ assertComponentExist(by: By): Promise\<void>
| ------ | ------------------- | ---- | -------------------- | | ------ | ------------------- | ---- | -------------------- |
| by | [By](#bydeprecated) | 是 | 目标控件的属性要求。 | | by | [By](#bydeprecated) | 是 | 目标控件的属性要求。 |
**错误码:**
以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)
| 错误码ID | 错误信息 |
| -------- | ------------------------------------------------ |
| 17000002 | if the async function was not called with await. |
| 17000003 | if the assertion failed. |
**示例:** **示例:**
```js ```js
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
- [分布式迁移标识](ts-universal-attributes-restoreId.md) - [分布式迁移标识](ts-universal-attributes-restoreId.md)
- [前景色设置](ts-universal-attributes-foreground-color.md) - [前景色设置](ts-universal-attributes-foreground-color.md)
- [组件内容模糊](ts-universal-attributes-foreground-blur-style.md) - [组件内容模糊](ts-universal-attributes-foreground-blur-style.md)
- [点击回弹](ts-universal-attributes-click-effect.md) - [点击回弹效果](ts-universal-attributes-click-effect.md)
- [无障碍属性](ts-universal-attributes-accessibility.md) - [无障碍属性](ts-universal-attributes-accessibility.md)
- 触摸交互控制 - 触摸交互控制
- [触摸热区设置](ts-universal-attributes-touch-target.md) - [触摸热区设置](ts-universal-attributes-touch-target.md)
...@@ -117,6 +117,7 @@ ...@@ -117,6 +117,7 @@
- [Column](ts-container-column.md) - [Column](ts-container-column.md)
- [ColumnSplit](ts-container-columnsplit.md) - [ColumnSplit](ts-container-columnsplit.md)
- [Counter](ts-container-counter.md) - [Counter](ts-container-counter.md)
- [EffectComponent](ts-container-effectcomponent.md)
- [Flex](ts-container-flex.md) - [Flex](ts-container-flex.md)
- [FlowItem](ts-container-flowitem.md) - [FlowItem](ts-container-flowitem.md)
- [FormLink](ts-container-formlink.md) - [FormLink](ts-container-formlink.md)
...@@ -142,7 +143,6 @@ ...@@ -142,7 +143,6 @@
- [TabContent](ts-container-tabcontent.md) - [TabContent](ts-container-tabcontent.md)
- [UIExtensionComponent](ts-container-ui-extension-component.md) - [UIExtensionComponent](ts-container-ui-extension-component.md)
- [WaterFlow](ts-container-waterflow.md) - [WaterFlow](ts-container-waterflow.md)
- [EffectComponent](ts-container-effectcomponent.md)
- 媒体组件 - 媒体组件
- [Video](ts-media-components-video.md) - [Video](ts-media-components-video.md)
- 绘制组件 - 绘制组件
......
...@@ -26,7 +26,7 @@ NavDestination() ...@@ -26,7 +26,7 @@ NavDestination()
| 名称 | 参数类型 | 描述 | | 名称 | 参数类型 | 描述 |
| ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| title | string&nbsp;\|&nbsp;[CustomBuilder](ts-types.md#custombuilder8)&nbsp;\|&nbsp;[NavigationCommonTitle](ts-basic-components-navigation.md#navigationcommontitle类型说明)&nbsp;\|&nbsp;[NavigationCustomTitle](ts-basic-components-navigation.md##navigationcustomtitle类型说明) | 页面标题。<br/>**说明:** <br/>使用NavigationCustomTitle类型设置height高度时,titleMode属性不会生效。<br/>字符串超长时,如果不设置副标题,先缩小再换行2行后以...截断。如果设置副标题,先缩小后以...截断。 | | title | string&nbsp;\|&nbsp;[CustomBuilder](ts-types.md#custombuilder8)&nbsp;\|&nbsp;[NavigationCommonTitle](ts-basic-components-navigation.md#navigationcommontitle类型说明)&nbsp;\|&nbsp;[NavigationCustomTitle](ts-basic-components-navigation.md#navigationcustomtitle类型说明) | 页面标题。<br/>**说明:** <br/>使用NavigationCustomTitle类型设置height高度时,titleMode属性不会生效。<br/>字符串超长时,如果不设置副标题,先缩小再换行2行后以...截断。如果设置副标题,先缩小后以...截断。 |
| hideTitleBar | boolean | 是否显示标题栏。<br/>默认值:false<br/>true:&nbsp;隐藏标题栏。<br/>false:&nbsp;显示标题栏。 | | hideTitleBar | boolean | 是否显示标题栏。<br/>默认值:false<br/>true:&nbsp;隐藏标题栏。<br/>false:&nbsp;显示标题栏。 |
## 事件 ## 事件
......
...@@ -7,20 +7,20 @@ ...@@ -7,20 +7,20 @@
> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
### 属性 ## 属性
| 名称 | 参数类型 | 描述 | | 名称 | 参数类型 | 描述 |
| ----------- | ------------------------------------------- | ------------------------------------------------------------ | | ----------- | ------------------------------------------- | ------------------------------------------------------------ |
| clickEffect | [ClickEffect](#clickeffect对象说明) \| null | 设置当前组件点击回弹效果。<br/>**说明:**<br/>可通过undefined或者null取消点击回弹效果。<br/>不建议在组件大小动态变化的场景中使用该功能。<br/>当组件无法触发通用事件时,不支持该属性。 | | clickEffect | [ClickEffect](#clickeffect对象说明) \| null | 设置当前组件点击回弹效果。<br/>**说明:**<br/>可通过undefined或者null取消点击回弹效果。<br/>不建议在组件大小动态变化的场景中使用该功能。<br/>当组件无法触发通用事件时,不支持该属性。 |
### ClickEffect对象说明 ## ClickEffect对象说明
| 名称 | 参数类型 | 必填 | 描述 | | 名称 | 参数类型 | 必填 | 描述 |
| ----- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | | ----- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| level | [ClickEffectLevel](ts-appendix-enums.md#clickeffectlevel10) | 是 | 设置当前组件点击回弹效果。<br/>**说明:**<br/>level等于undefined或者null时, ClickEffect采用ClickEffectLevel.LIGHT对应的回弹效果, 缩放比参照scale说明。 | | level | [ClickEffectLevel](ts-appendix-enums.md#clickeffectlevel10) | 是 | 设置当前组件点击回弹效果。<br/>**说明:**<br/>level等于undefined或者null时, ClickEffect采用ClickEffectLevel.LIGHT对应的回弹效果, 缩放比参照scale说明。 |
| scale | number | 否 | 回弹缩放比例,支持在设置ClickEffectLevel的基础上微调回弹缩放比例。<br/>**说明:**<br/>level等于ClickEffectLevel.LIGHT时,默认值:0.90<br/>level等于ClickEffectLevel.MIDDLE或者ClickEffectLevel.HEAVY时,默认值:0.95<br/>level等于undefined或者null时,level为ClickEffectLevel.LIGHT,默认值:0.90<br/>scale等于undefined或者null时,scale与当前设置的level对应的默认缩放比相同。<br/> | | scale | number | 否 | 回弹缩放比例,支持在设置ClickEffectLevel的基础上微调回弹缩放比例。<br/>**说明:**<br/>level等于ClickEffectLevel.LIGHT时,默认值:0.90<br/>level等于ClickEffectLevel.MIDDLE或者ClickEffectLevel.HEAVY时,默认值:0.95<br/>level等于undefined或者null时,level为ClickEffectLevel.LIGHT,默认值:0.90<br/>scale等于undefined或者null时,scale与当前设置的level对应的默认缩放比相同。<br/> |
### 示例 ## 示例
```ts ```ts
// xxx.ets // xxx.ets
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
> >
> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
ArkUI组件默认支持拖拽。 ArkUI组件默认支持拖拽。
当以下组件的draggable属性设置为true时可以响应拖拽事件,此时,组件不需要配置数据传输,即可进行拖拽。其他组件需要开发者将draggable属性设置为true且在onDragStart等接口中实现数据传输相关内容,才能完成拖拽。 当以下组件的draggable属性设置为true时可以响应拖拽事件,此时,组件不需要配置数据传输,即可进行拖拽。其他组件需要开发者将draggable属性设置为true且在onDragStart等接口中实现数据传输相关内容,才能完成拖拽。
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
> >
> 应用本身预置的资源文件(即应用在安装前的HAP包中已经存在的资源文件)仅支持本地应用内拖拽。 > 应用本身预置的资源文件(即应用在安装前的HAP包中已经存在的资源文件)仅支持本地应用内拖拽。
ArkUI组件默认支持拖拽。 ArkUI组件默认支持拖拽。
当以下组件的[draggable](ts-universal-attributes-drag-drop.md)属性设置为true时可以响应拖拽事件,此时,组件不需要配置数据传输,即可进行拖拽。其他组件需要开发者将[draggable](ts-universal-attributes-drag-drop.md)属性设置为true且在onDragStart等接口中实现数据传输相关内容,才能完成拖拽。 当以下组件的[draggable](ts-universal-attributes-drag-drop.md)属性设置为true时可以响应拖拽事件,此时,组件不需要配置数据传输,即可进行拖拽。其他组件需要开发者将[draggable](ts-universal-attributes-drag-drop.md)属性设置为true且在onDragStart等接口中实现数据传输相关内容,才能完成拖拽。
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
- [事件错误码](errorcode-CommonEventService.md) - [事件错误码](errorcode-CommonEventService.md)
- [通知错误码](errorcode-notification.md) - [通知错误码](errorcode-notification.md)
- [DistributedNotificationService错误码](errorcode-DistributedNotificationService.md) - [DistributedNotificationService错误码](errorcode-DistributedNotificationService.md)
- [拖拽事件错误码](errorcode-drag-event.md)
- UI界面 - UI界面
- [动画错误码](errorcode-animator.md) - [动画错误码](errorcode-animator.md)
- [弹窗错误码](errorcode-promptAction.md) - [弹窗错误码](errorcode-promptAction.md)
- [页面路由错误码](errorcode-router.md) - [页面路由错误码](errorcode-router.md)
- [用户界面外观服务错误码](errorcode-uiappearance.md) - [用户界面外观服务错误码](errorcode-uiappearance.md)
- [拖拽事件错误码](errorcode-drag-event.md)
- 图形图像 - 图形图像
- [色彩管理错误码](errorcode-colorspace-manager.md) - [色彩管理错误码](errorcode-colorspace-manager.md)
- [屏幕错误码](errorcode-display.md) - [屏幕错误码](errorcode-display.md)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册