@deveco-test/deveco-code 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.json +6 -5
  3. package/resources/deveco/skills/customize-deveco/.deveco-builtin +1 -0
  4. package/resources/deveco/skills/customize-deveco/SKILL.md +469 -0
  5. package/resources/deveco/skills/deveco-cli/.deveco-builtin +1 -0
  6. package/resources/deveco/skills/deveco-cli/SKILL.md +240 -0
  7. package/resources/deveco/skills/hmos-arkui-develop-skill/.deveco-builtin +1 -0
  8. package/resources/deveco/skills/hmos-arkui-develop-skill/SKILL.md +83 -0
  9. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/01-layout.md +629 -0
  10. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/02-basic-components.md +645 -0
  11. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/03-data-display.md +81 -0
  12. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/04-selectors.md +76 -0
  13. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/05-media.md +60 -0
  14. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/06-advanced.md +32 -0
  15. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/07-security.md +30 -0
  16. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/08-state-decorators.md +79 -0
  17. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/09-animation.md +111 -0
  18. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/10-gesture.md +59 -0
  19. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/11-dialog-menu.md +92 -0
  20. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/12-navigation.md +81 -0
  21. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/13-rendering.md +22 -0
  22. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/14-extension.md +22 -0
  23. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/15-theme-style.md +10 -0
  24. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/16-enums.md +87 -0
  25. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/17-resources.md +1379 -0
  26. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/18-error-code.md +24 -0
  27. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-apis/_index.md +75 -0
  28. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/00-arkts-syntax.md +229 -0
  29. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/01-import.md +116 -0
  30. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/02-uicontext.md +56 -0
  31. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/03-component.md +105 -0
  32. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/04-build.md +41 -0
  33. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/05-state.md +300 -0
  34. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/06-rendering.md +67 -0
  35. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/07-attribute-params.md +219 -0
  36. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/08-navigation.md +102 -0
  37. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/09-dialog.md +72 -0
  38. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/10-style.md +90 -0
  39. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/11-extension.md +54 -0
  40. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/12-layout.md +69 -0
  41. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/13-performance.md +27 -0
  42. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/14-deprecated.md +28 -0
  43. package/resources/deveco/skills/hmos-arkui-develop-skill/references/quick-rules/_index.md +79 -0
  44. package/resources/deveco/skills/hmos-runtime-fix-skill/.deveco-builtin +1 -0
  45. package/resources/deveco/skills/hmos-runtime-fix-skill/SKILL.md +187 -0
  46. package/resources/deveco/skills/hmos-runtime-fix-skill/SKILL_CN.md +160 -0
  47. package/resources/deveco/skills/hmos-runtime-fix-skill/evals/evals.json +17 -0
  48. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/businesserror_patterns.md +17 -0
  49. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/error_patterns.md +31 -0
  50. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/fault-mode-library.md +57 -0
  51. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/outofmemoryerror_patterns.md +19 -0
  52. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/rangeerror_patterns.md +15 -0
  53. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/referenceerror_patterns.md +23 -0
  54. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/syntaxerror_patterns.md +14 -0
  55. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/typeerror_patterns.md +19 -0
  56. package/resources/deveco/skills/hmos-runtime-fix-skill/reference/urierror_patterns.md +17 -0
  57. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/collect-hilog.mjs +120 -0
  58. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/jscrash-report.mjs +138 -0
  59. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/parse-jscrash-log.mjs +126 -0
  60. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/shared/deveco-cli.mjs +79 -0
  61. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/shared/jscrash-parse.mjs +389 -0
  62. package/resources/deveco/skills/hmos-runtime-fix-skill/scripts/shared/utils.mjs +27 -0
@@ -0,0 +1,645 @@
1
+ ## 2. 基础组件
2
+
3
+
4
+ > **组件索引**:`Text`、`Span`、`ImageSpan`、`SymbolSpan / SymbolGlyph`、`TextInput`、`TextArea`、`Button`、`Image`、`Slider`、`Toggle`、`Radio`、`Checkbox`、`CheckboxGroup`、`Progress`、`Rating`、`LoadingProgress`、`Search`、`Select`、`RichEditor`、`overlay`、`其他基础组件速查`
5
+
6
+ ### Text
7
+
8
+ 文本显示组件。可包含 Span/ImageSpan/SymbolSpan 子组件。
9
+
10
+ **构造:** `Text(content?: string | Resource, value?: TextOptions)`
11
+
12
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
13
+ |------|------|------|--------|------|
14
+ | content | string \| Resource | 否 | '' | 文本内容 |
15
+ | value | TextOptions | 否 | — | API 11+ 初始化选项 |
16
+
17
+ **属性方法:**
18
+
19
+ | 方法 | 签名 | 默认值 | 说明 |
20
+ |------|------|--------|------|
21
+ | .fontColor | `.fontColor(value: ResourceColor)` | — | 字体颜色 |
22
+ | .fontSize | `.fontSize(value: Length)` | 16fp | 字号 |
23
+ | .fontWeight | `.fontWeight(value: FontWeight \| number \| string)` | Normal | 字重 |
24
+ | .fontStyle | `.fontStyle(value: FontStyle)` | Normal | 字体样式 |
25
+ | .fontFamily | `.fontFamily(value: ResourceStr)` | 'HarmonyOS Sans' | 字体族 |
26
+ | .letterSpacing | `.letterSpacing(value: number \| string)` | 0 | 字符间距 |
27
+ | .textAlign | `.textAlign(value: TextAlign)` | Start | 水平对齐 |
28
+ | .baselineOffset | `.baselineOffset(value: number \| ResourceStr)` | 0 | 基线偏移 |
29
+ | .decoration | `.decoration(value: DecorationStyleInterface)` | {type:None, color:Black, style:SOLID} | 装饰线 |
30
+ | .textOverflow | `.textOverflow(value: {overflow: TextOverflow})` | Clip | 溢出处理 |
31
+ | .maxLines | `.maxLines(value: number)` | Infinity | 最大行数 |
32
+ | .lineHeight | `.lineHeight(value: number \| string)` | — | 行高 |
33
+ | .textShadow | `.textShadow(value: ShadowOptions \| Array<ShadowOptions>)` | — | API 10+ 文字阴影 |
34
+ | .minFontSize | `.minFontSize(value: number \| string)` | — | 最小字号 |
35
+ | .maxFontSize | `.maxFontSize(value: number \| string)` | — | 最大字号 |
36
+ | .copyOption | `.copyOption(value: CopyOptions)` | None | API 9+ 复制选项 |
37
+ | .selection | `.selection(start: number, end: number)` | — | API 11+ 选中区域 |
38
+ | .ellipsisMode | `.ellipsisMode(value: EllipsisMode)` | END | API 11+ 省略位置 |
39
+ | .textCase | `.textCase(value: TextCase)` | - | 大小写。TextCase:Normal(0)/LowerCase(1)/UpperCase(2) |
40
+ | .fontFeature | `.fontFeature(value: string)` | — | API 12+ 文字特性 |
41
+ | .heightAdaptivePolicy | `.heightAdaptivePolicy(value: TextHeightAdaptivePolicy)` | MaxLines | API 10+ 自适应策略 |
42
+ | .textIndent | `.textIndent(value: Length)` | 0 | API 10+ 首行缩进 |
43
+ | .wordBreak | `.wordBreak(value: WordBreak)` | BREAK_WORD | API 11+ 断行规则 |
44
+ | .halfLeading | `.halfLeading(value: boolean)` | false | API 12+ 垂直居中 |
45
+ | .lineSpacing | `.lineSpacing(value: LineSpacingOptions)` | — | API 12+ 行间距 |
46
+ | .caretColor | `.caretColor(value: ResourceColor)` | '#007DFF' | API 14+ 手柄颜色 |
47
+ | .selectedBackgroundColor | `.selectedBackgroundColor(value: ResourceColor)` | — | API 14+ 选中底板色 |
48
+ | .textSelectable | `.textSelectable(value: TextSelectableMode)` | — | API 12+ 可选择 |
49
+ | .enableDataDetector | `.enableDataDetector(value: boolean)` | false | API 11+ 文本识别 |
50
+ | .lineBreakStrategy | `.lineBreakStrategy(value: LineBreakStrategy)` | GREEDY | API 12+ 折行规则 |
51
+ | .maxFontScale | `.maxFontScale(value: number \| Resource)` | — | API 12+ 最大缩放倍数 |
52
+ | .minFontScale | `.minFontScale(value: number \| Resource)` | — | API 12+ 最小缩放倍数 |
53
+ | .contentTransition | `.contentTransition(value: Optional\<ContentTransition\>)` | — | API 20+ 动效 |
54
+ | .marqueeOptions | `.marqueeOptions(value: TextMarqueeOptions)` | — | API 18+ 跑马灯 |
55
+ | .enableHapticFeedback | `.enableHapticFeedback(value: boolean)` | — | API 13+ 触控反馈 |
56
+
57
+ > DecorationStyleInterface:`{ type: TextDecorationType, color?: ResourceColor, style?: TextDecorationStyle }`
58
+ > TextDecorationType 枚举:Underline / Overline / LineThrough / None
59
+ > TextDecorationStyle 枚举:SOLID / DOUBLE / DOTTED / DASHED / WAVY
60
+ >
61
+ > ShadowOptions:`{ radius: number, color?: ResourceColor, offsetX?: number, offsetY?: number }`
62
+
63
+ **事件:**
64
+
65
+ | 事件 | 签名 | 说明 |
66
+ |------|------|------|
67
+ | .onCopy | `.onCopy(event: (value: string) => void)` | API 9+ 复制回调 |
68
+
69
+ ---
70
+
71
+ ### Span
72
+
73
+ 文本行内片段。
74
+
75
+ **构造:** `Span(value: string | Resource)`
76
+
77
+ **属性方法:**
78
+
79
+ | 方法 | 签名 | 默认值 | 说明 |
80
+ |------|------|--------|------|
81
+ | .fontColor | `.fontColor(value: ResourceColor)` | — | 字体颜色 |
82
+ | .fontSize | `.fontSize(value: Length)` | 16fp | 字号 |
83
+ | .fontWeight | `.fontWeight(value: FontWeight \| number)` | Normal | 字重 |
84
+ | .fontStyle | `.fontStyle(value: FontStyle)` | Normal | 字体样式 |
85
+ | .fontFamily | `.fontFamily(value: ResourceStr)` | — | 字体族 |
86
+ | .decoration | `.decoration(value: DecorationStyleInterface)` | {type:None} | 装饰线 |
87
+ | .letterSpacing | `.letterSpacing(value: number \| string)` | 0 | 字符间距 |
88
+ | .textCase | `.textCase(value: TextCase)` | - | 大小写。TextCase:Normal(0)/LowerCase(1)/UpperCase(2) |
89
+ | .lineHeight | `.lineHeight(value: Length)` | — | 行高 |
90
+ | .textShadow | `.textShadow(value: ShadowOptions \| Array<ShadowOptions>)` | — | API 10+ 文字阴影 |
91
+
92
+ ---
93
+
94
+ ### ImageSpan
95
+
96
+ 文本行内图片。
97
+
98
+ **构造:** `ImageSpan(value: ResourceStr | PixelMap)`
99
+
100
+ **属性方法:**
101
+
102
+ | 方法 | 签名 | 默认值 | 说明 |
103
+ |------|------|--------|------|
104
+ | .verticalAlign | `.verticalAlign(value: ImageSpanAlignment)` | BOTTOM | 垂直对齐 |
105
+ | .objectFit | `.objectFit(value: ImageFit)` | Cover | 填充方式 |
106
+ | .alt | `.alt(value: PixelMap)` | — | API 12+ 占位图 |
107
+
108
+ **事件:**
109
+
110
+ | 事件 | 签名 | 说明 |
111
+ |------|------|------|
112
+ | .onComplete | `.onComplete(event: () => void)` | 加载完成 |
113
+ | .onError | `.onError(event: () => void)` | 加载失败 |
114
+
115
+ ---
116
+
117
+ ### SymbolSpan / SymbolGlyph
118
+
119
+ 系统 Symbol 图标。
120
+
121
+ **构造:** `SymbolSpan(value: Resource)` / `SymbolGlyph(value?: Resource)`
122
+
123
+ **属性方法 (两者共用):**
124
+
125
+ | 方法 | 签名 | 默认值 | 说明 |
126
+ |------|------|--------|------|
127
+ | .fontColor | `.fontColor(value: Array\<ResourceColor\>)` | — | 颜色数组 |
128
+ | .fontSize | `.fontSize(value: Length)` | 16fp | 尺寸 |
129
+ | .fontWeight | `.fontWeight(value: FontWeight \| number)` | Normal | 字重 |
130
+ | .renderingStrategy | `.renderingStrategy(value: SymbolRenderingStrategy)` | — | 渲染策略 |
131
+ | .effectStrategy | `.effectStrategy(value: SymbolEffectStrategy)` | — | 动效策略 |
132
+
133
+ SymbolGlyph 额外方法:`.symbolEffect(effect: SymbolEffect, isActive?: boolean)`
134
+
135
+ ---
136
+
137
+ ### TextInput
138
+
139
+ 单行文本输入框。
140
+
141
+ **构造:** `TextInput(value?: TextInputOptions)`
142
+
143
+ **TextInputOptions:**
144
+
145
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
146
+ |------|------|------|--------|------|
147
+ | placeholder | ResourceStr | 否 | — | 占位文本 |
148
+ | text | ResourceStr | 否 | — | 输入内容,支持 $$ |
149
+ | controller | TextInputController | 否 | — | 控制器 |
150
+
151
+ **属性方法:**
152
+
153
+ | 方法 | 签名 | 默认值 | 说明 |
154
+ |------|------|--------|------|
155
+ | .type | `.type(value: InputType)` | Normal | 输入类型 |
156
+ | .placeholderColor | `.placeholderColor(value: ResourceColor)` | 跟随主题 | 占位符颜色 |
157
+ | .placeholderFont | `.placeholderFont(value?: Font)` | — | 占位符字体 |
158
+ | .enterKeyType | `.enterKeyType(value: EnterKeyType)` | Done | 回车键类型 |
159
+ | .caretColor | `.caretColor(value: ResourceColor)` | '#007DFF' | 光标颜色 |
160
+ | .maxLength | `.maxLength(value: number)` | Infinity | 最大字符数 |
161
+ | .fontColor | `.fontColor(value: ResourceColor)` | — | 字体颜色 |
162
+ | .fontSize | `.fontSize(value: Length)` | 16fp | 字号 |
163
+ | .fontStyle | `.fontStyle(value: FontStyle)` | Normal | 字体样式 |
164
+ | .fontWeight | `.fontWeight(value: FontWeight \| number \| string)` | Normal | 字重 |
165
+ | .fontFamily | `.fontFamily(value: ResourceStr)` | 'HarmonyOS Sans' | 字体族 |
166
+ | .showPasswordIcon | `.showPasswordIcon(value: boolean)` | true | 密码模式图标 |
167
+ | .copyOption | `.copyOption(value: CopyOptions)` | LocalDevice | 复制选项 |
168
+ | .textAlign | `.textAlign(value: TextAlign)` | Start | 对齐方式 |
169
+ | .inputFilter | `.inputFilter(value: ResourceStr, error?: Callback\<string\>)` | — | API 8+ 正则过滤 |
170
+ | .style | `.style(value: TextInputStyle \| TextContentStyle)` | Default | API 9+ 输入框风格 |
171
+ | .showUnderline | `.showUnderline(value: boolean)` | false | API 10+ 下划线 |
172
+ | .selectedBackgroundColor | `.selectedBackgroundColor(value: ResourceColor)` | — | API 10+ 选中底板色 |
173
+ | .caretStyle | `.caretStyle(value: CaretStyle)` | - | API 10+ 光标样式。CaretStyle={width:Length默认2vp, color默认#ff007dff} |
174
+ | .showCounter | `.showCounter(value: boolean)` | false | API 10+ 字数统计 |
175
+ | .counterType | `.counterType(value: InputCounterType)` | — | API 11+ 计数器类型 |
176
+ | .enableKeyboardOnFocus | `.enableKeyboardOnFocus(value: boolean)` | true | API 10+ 聚焦弹键盘 |
177
+ | .selectionMenuHidden | `.selectionMenuHidden(value: boolean)` | false | API 12+ 隐藏选择菜单 |
178
+
179
+ **事件:**
180
+
181
+ | 事件 | 签名 | 说明 |
182
+ |------|------|------|
183
+ | .onChange | `.onChange(event: (value: string) => void)` | 文本变化 |
184
+ | .onSubmit | `.onSubmit(event: (enterKey: EnterKeyType) => void)` | 回车提交 |
185
+ | .onEditChange | `.onEditChange(event: (isEditing: boolean) => void)` | 编辑状态变化 |
186
+ | .onCopy | `.onCopy(event: (value: string) => void)` | API 9+ 复制 |
187
+ | .onCut | `.onCut(event: (value: string) => void)` | API 9+ 剪切 |
188
+ | .onPaste | `.onPaste(event: (value: string) => void)` | API 9+ 粘贴 |
189
+
190
+ ---
191
+
192
+ ### TextArea
193
+
194
+ 多行文本输入框。
195
+
196
+ **构造:** `TextArea(value?: TextAreaOptions)`
197
+
198
+ **TextAreaOptions:**
199
+
200
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
201
+ |------|------|------|--------|------|
202
+ | placeholder | ResourceStr | 否 | — | 占位文本 |
203
+ | text | ResourceStr | 否 | — | 输入内容,支持 $$ |
204
+ | controller | TextAreaController | 否 | — | 控制器 |
205
+
206
+ **属性方法:**
207
+
208
+ | 方法 | 签名 | 默认值 | 说明 |
209
+ |------|------|--------|------|
210
+ | .placeholderColor | `.placeholderColor(value: ResourceColor)` | 跟随主题 | 占位符颜色 |
211
+ | .placeholderFont | `.placeholderFont(value?: Font)` | — | 占位符字体 |
212
+ | .textAlign | `.textAlign(value: TextAlign)` | Start | 文本对齐 |
213
+ | .caretColor | `.caretColor(value: ResourceColor)` | '#007DFF' | 光标颜色 |
214
+ | .fontColor | `.fontColor(value: ResourceColor)` | — | 字体颜色 |
215
+ | .fontSize | `.fontSize(value: Length)` | 16fp | 字号 |
216
+ | .fontStyle | `.fontStyle(value: FontStyle)` | Normal | 字体样式 |
217
+ | .fontWeight | `.fontWeight(value: FontWeight \| number)` | Normal | 字重 |
218
+ | .fontFamily | `.fontFamily(value: ResourceStr)` | 'HarmonyOS Sans' | 字体族 |
219
+ | .copyOption | `.copyOption(value: CopyOptions)` | LocalDevice | 复制选项 |
220
+ | .barState | `.barState(value: BarState)` | Auto | 滚动条状态 |
221
+ | .maxLength | `.maxLength(value: number)` | Infinity | 最大字符数 |
222
+ | .showCounter | `.showCounter(value: boolean)` | false | API 10+ 字数统计 |
223
+ | .enableKeyboardOnFocus | `.enableKeyboardOnFocus(value: boolean)` | true | 聚焦弹键盘 |
224
+
225
+ **事件:**
226
+
227
+ | 事件 | 签名 | 说明 |
228
+ |------|------|------|
229
+ | .onChange | `.onChange(event: (value: string) => void)` | 文本变化 |
230
+ | .onSubmit | `.onSubmit(event: (enterKey: EnterKeyType) => void)` | API 18+ 回车 |
231
+ | .onCopy / .onCut / .onPaste | 同 TextInput | — |
232
+
233
+ ---
234
+
235
+ ### Button
236
+
237
+ 按钮组件。可包含单个子组件。
238
+
239
+ **构造:**
240
+
241
+ ```typescript
242
+ Button(options: ButtonOptions) // 含子组件
243
+ Button(label?: ResourceStr, options?: ButtonOptions) // 文本按钮
244
+ Button() // 空按钮
245
+ ```
246
+
247
+ **ButtonOptions:**
248
+
249
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
250
+ |------|------|------|--------|------|
251
+ | type | ButtonType | 否 | ROUNDED_RECTANGLE | 按钮形状 |
252
+ | stateEffect | boolean | 否 | true | 按压态效果 |
253
+ | buttonStyle | ButtonStyleMode | 否 | EMPHASIZED | API 11+ 样式模式 |
254
+ | controlSize | ControlSize | 否 | NORMAL | API 11+ 尺寸 |
255
+ | role | ButtonRole | 否 | NORMAL | API 12+ 角色 |
256
+
257
+ **属性方法:**
258
+
259
+ | 方法 | 签名 | 默认值 | 说明 |
260
+ |------|------|--------|------|
261
+ | .type | `.type(value: ButtonType)` | ROUNDED_RECTANGLE | 按钮形状 |
262
+ | .fontSize | `.fontSize(value: Length)` | 跟随 controlSize | 字号 |
263
+ | .fontColor | `.fontColor(value: ResourceColor)` | 白色 | 字体颜色 |
264
+ | .fontWeight | `.fontWeight(value: FontWeight \| number \| string)` | 500 | 字重 |
265
+ | .fontStyle | `.fontStyle(value: FontStyle)` | Normal | API 8+ 字体样式 |
266
+ | .stateEffect | `.stateEffect(value: boolean)` | true | 按压效果 |
267
+ | .fontFamily | `.fontFamily(value: string \| Resource)` | 'HarmonyOS Sans' | API 8+ 字体族 |
268
+ | .labelStyle | `.labelStyle(value: LabelStyle)` | — | API 10+ 文本样式 |
269
+ | .buttonStyle | `.buttonStyle(value: ButtonStyleMode)` | EMPHASIZED | API 11+ 样式 |
270
+ | .controlSize | `.controlSize(value: ControlSize)` | NORMAL | API 11+ 尺寸 |
271
+ | .role | `.role(value: ButtonRole)` | NORMAL | API 12+ 角色 |
272
+ | .contentModifier | `.contentModifier(modifier: ContentModifier\<ButtonConfiguration\>)` | — | API 12+ 自定义内容 |
273
+ | .minFontScale | `.minFontScale(value: number \| Resource)` | — | API 18+ 最小缩放 |
274
+ | .maxFontScale | `.maxFontScale(value: number \| Resource)` | — | API 18+ 最大缩放 |
275
+
276
+ ---
277
+
278
+ ### Image
279
+
280
+ 图片组件。
281
+
282
+ **构造:** `Image(src: PixelMap | ResourceStr | DrawableDescriptor)` 或 `Image(src, imageAIOptions?)` API 12+
283
+
284
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
285
+ |------|------|------|--------|------|
286
+ | src | PixelMap \| ResourceStr \| DrawableDescriptor | 是 | — | 图片数据源 |
287
+ | imageAIOptions | ImageAIOptions | 否 | — | API 12+ AI 分析选项 |
288
+
289
+ **属性方法:**
290
+
291
+ | 方法 | 签名 | 默认值 | 说明 |
292
+ |------|------|--------|------|
293
+ | .alt | `.alt(value: string \| Resource \| PixelMap)` | null | 占位图 |
294
+ | .objectFit | `.objectFit(value: ImageFit)` | Cover | 填充方式 |
295
+ | .objectRepeat | `.objectRepeat(value: ImageRepeat)` | NoRepeat | 重复样式 |
296
+ | .interpolation | `.interpolation(value: ImageInterpolation)` | Low | 插值效果 |
297
+ | .renderMode | `.renderMode(value: ImageRenderMode)` | Original | 渲染模式 |
298
+ | .sourceSize | `.sourceSize(value: ImageSourceSize)` | — | 解码尺寸 |
299
+ | .fillColor | `.fillColor(value: ResourceColor)` | — | 填充色(仅SVG) |
300
+ | .autoResize | `.autoResize(value: boolean)` | false | 自动缩放 |
301
+ | .syncLoad | `.syncLoad(value: boolean)` | false | API 8+ 同步加载 |
302
+ | .colorFilter | `.colorFilter(value: ColorFilter \| DrawingColorFilter)` | — | API 9+ 颜色滤镜 |
303
+ | .autoPlay | `.autoPlay(value: boolean)` | true | API 11+ 自动播放动图 |
304
+ | .resizable | `.resizable(value: ResizableOptions)` | — | API 11+ 可拉伸 |
305
+ | .copyOption | `.copyOption(value: CopyOptions)` | None | API 9+ 复制选项 |
306
+ | .fitOriginalSize | `.fitOriginalSize(value: boolean)` | false | 跟随图源尺寸 |
307
+ | .matchTextDirection | `.matchTextDirection(value: boolean)` | false | 跟随文字方向 |
308
+ | .imageMatrix | `.imageMatrix(value: ImageMatrix)` | — | API 15+ 变换矩阵 |
309
+ | .enableAnalyzer | `.enableAnalyzer(value: boolean)` | false | API 12+ AI 图像分析 |
310
+
311
+ **事件:**
312
+
313
+ | 事件 | 签名 | 说明 |
314
+ |------|------|------|
315
+ | .onComplete | `.onComplete(event: (result: ImageLoadResult) => void)` | 加载成功 |
316
+ | .onError | `.onError(event: (error: ImageError) => void)` | 加载失败 |
317
+ | .onFinish | `.onFinish(event: () => void)` | API 11+ 动图播放完成 |
318
+
319
+ > ImageLoadResult:`{ width: number, height: number, componentWidth: number, componentHeight: number, loadingStatus: number }`
320
+ > ImageError:`{ componentWidth: number, componentHeight: number, message: string }`
321
+
322
+ ---
323
+
324
+ ### Slider
325
+
326
+ 滑动选择器。
327
+
328
+ **构造:** `Slider(options?: SliderOptions)`
329
+
330
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
331
+ |------|------|------|--------|------|
332
+ | value | number | 否 | 0 | 当前值 |
333
+ | min | number | 否 | 0 | 最小值 |
334
+ | max | number | 否 | 100 | 最大值 |
335
+ | step | number | 否 | 1 | 步长 |
336
+ | style | SliderStyle | 否 | OutSet | 样式 |
337
+ | direction | Axis | 否 | Horizontal | 方向 |
338
+ | reverse | boolean | 否 | false | 是否反转 |
339
+
340
+ **属性方法:**
341
+
342
+ | 方法 | 签名 | 默认值 | 说明 |
343
+ |------|------|--------|------|
344
+ | .blockColor | `.blockColor(value: ResourceColor)` | — | 滑块颜色 |
345
+ | .trackColor | `.trackColor(value: ResourceColor)` | — | 轨道颜色 |
346
+ | .selectedColor | `.selectedColor(value: ResourceColor)` | — | 已选颜色 |
347
+ | .showSteps | `.showSteps(value: boolean)` | false | 显示步长 |
348
+ | .showTips | `.showTips(value: boolean)` | false | 显示提示 |
349
+ | .trackThickness | `.trackThickness(value: Length)` | — | 轨道粗细 |
350
+ | .blockSize | `.blockSize(value: Size)` | — | 滑块尺寸 |
351
+ | .blockBorderColor | `.blockBorderColor(value: ResourceColor)` | — | 滑块边框色 |
352
+ | .blockBorderWidth | `.blockBorderWidth(value: Length)` | 0 | 滑块边框宽 |
353
+
354
+ **事件:**
355
+
356
+ | 事件 | 签名 | 说明 |
357
+ |------|------|------|
358
+ | .onChange | `.onChange(event: (value: number, mode: SliderChangeMode) => void)` | 值变化 |
359
+
360
+ > onChange 回调:`(value: number, mode: SliderChangeMode) => void`
361
+ > SliderChangeMode 枚举:Begin / Moving / End / Click
362
+
363
+ ---
364
+
365
+ ### Toggle
366
+
367
+ 开关/复选/按钮切换组件。
368
+
369
+ **构造:** `Toggle(options: ToggleOptions)`
370
+
371
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
372
+ |------|------|------|--------|------|
373
+ | type | ToggleType | 是 | Switch | 类型(Checkbox/Switch/Button) |
374
+ | isOn | boolean | 否 | false | 开关状态,支持 $$ |
375
+
376
+ **属性方法:**
377
+
378
+ | 方法 | 签名 | 默认值 | 说明 |
379
+ |------|------|--------|------|
380
+ | .selectedColor | `.selectedColor(value: ResourceColor)` | — | 选中颜色 |
381
+ | .switchPointColor | `.switchPointColor(value: ResourceColor)` | — | Switch 圆点颜色 |
382
+ | .switchStyle | `.switchStyle(value: SwitchStyle)` | — | API 12+ Switch 样式 |
383
+
384
+ **事件:**
385
+
386
+ | 事件 | 签名 | 说明 |
387
+ |------|------|------|
388
+ | .onChange | `.onChange(event: (isOn: boolean) => void)` | 状态变化 |
389
+
390
+ ---
391
+
392
+ ### Radio
393
+
394
+ 单选按钮。
395
+
396
+ **构造:** `Radio(options: RadioOptions)`
397
+
398
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
399
+ |------|------|------|--------|------|
400
+ | value | string | 是 | — | 当前 Radio 标识 |
401
+ | group | string | 是 | — | 分组名称 |
402
+ | indicatorType | RadioIndicatorType | 否 | — | 指示器类型 |
403
+ | indicatorBuilder | CustomBuilder | 否 | — | 自定义指示器 |
404
+
405
+ **属性方法:**
406
+
407
+ | 方法 | 签名 | 默认值 | 说明 |
408
+ |------|------|--------|------|
409
+ | .checked | `.checked(value: boolean)` | false | 选中状态,支持 $$ |
410
+ | .radioStyle | `.radioStyle(value?: RadioStyle)` | — | 样式 |
411
+
412
+ **事件:**
413
+
414
+ | 事件 | 签名 | 说明 |
415
+ |------|------|------|
416
+ | .onChange | `.onChange(event: (isChecked: boolean) => void)` | 选中变化 |
417
+
418
+ ---
419
+
420
+ ### Checkbox
421
+
422
+ 复选框。
423
+
424
+ **构造:** `Checkbox(options?: CheckboxOptions)`
425
+
426
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
427
+ |------|------|------|--------|------|
428
+ | name | string | 否 | — | 名称 |
429
+ | group | string | 否 | — | 分组 |
430
+ | indicatorBuilder | CustomBuilder | 否 | — | 自定义指示器 |
431
+
432
+ **属性方法:**
433
+
434
+ | 方法 | 签名 | 默认值 | 说明 |
435
+ |------|------|--------|------|
436
+ | .select | `.select(value: boolean)` | false | 选中状态,支持 $$ |
437
+ | .selectedColor | `.selectedColor(value: ResourceColor)` | — | 选中颜色 |
438
+ | .unselectedColor | `.unselectedColor(value: ResourceColor)` | — | 未选中颜色 |
439
+ | .mark | `.mark(value: MarkStyle)` | - | 勾选样式。MarkStyle={strokeColor默认White, size:Length, strokeWidth默认2} |
440
+ | .shape | `.shape(value: CheckBoxShape)` | - | 形状。CheckBoxShape(API 11+):CIRCLE(0)/ROUNDED_SQUARE(1) |
441
+
442
+ **事件:**
443
+
444
+ | 事件 | 签名 | 说明 |
445
+ |------|------|------|
446
+ | .onChange | `.onChange(event: (value: boolean) => void)` | 选中变化 |
447
+
448
+ ---
449
+
450
+ ### CheckboxGroup
451
+
452
+ 复选框组。
453
+
454
+ **构造:** `CheckboxGroup(options?: CheckboxGroupOptions)`
455
+
456
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
457
+ |------|------|------|--------|------|
458
+ | group | string | 否 | — | 分组名称 |
459
+
460
+ **属性方法:**
461
+
462
+ | 方法 | 签名 | 默认值 | 说明 |
463
+ |------|------|--------|------|
464
+ | .selectAll | `.selectAll(value: boolean)` | false | 全选,支持 $$ |
465
+ | .selectedColor | `.selectedColor(value: ResourceColor)` | — | 选中颜色 |
466
+ | .unselectedColor | `.unselectedColor(value: ResourceColor)` | — | 未选中颜色 |
467
+ | .mark | `.mark(value: MarkStyle)` | - | 勾选样式。MarkStyle={strokeColor默认White, size:Length, strokeWidth默认2} |
468
+ | .checkboxShape | `.checkboxShape(value: CheckBoxShape)` | - | 形状。CheckBoxShape(API 11+):CIRCLE(0)/ROUNDED_SQUARE(1) |
469
+
470
+ **事件:**
471
+
472
+ | 事件 | 签名 | 说明 |
473
+ |------|------|------|
474
+ | .onChange | `.onChange(event: (value: CheckboxGroupResult) => void)` | 变化回调,CheckboxGroupResult:`{ name: Array<string>, status: SelectStatus }`,SelectStatus:0=All(全选),1=Part(部分),2=None(全未选) |
475
+
476
+ ---
477
+
478
+ ### Progress
479
+
480
+ 进度条。
481
+
482
+ **构造:** `Progress(options: ProgressOptions)`
483
+
484
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
485
+ |------|------|------|--------|------|
486
+ | value | number | 是 | — | 当前值 |
487
+ | total | number | 否 | 100 | 总值 |
488
+ | type | ProgressType | 否 | Linear | 类型 |
489
+
490
+ **属性方法:**
491
+
492
+ | 方法 | 签名 | 默认值 | 说明 |
493
+ |------|------|--------|------|
494
+ | .value | `.value(value: number)` | — | 当前值 |
495
+ | .color | `.color(value: ResourceColor \| LinearGradient)` | — | 进度颜色 |
496
+ | .style | `.style(value: ProgressStyleOptions)` | — | 样式 |
497
+ | .backgroundColor | `.backgroundColor(value: ResourceColor)` | — | 背景色 |
498
+
499
+ ---
500
+
501
+ ### Rating
502
+
503
+ 评分组件。
504
+
505
+ **构造:** `Rating(options?: RatingOptions)`
506
+
507
+ **RatingOptions:**
508
+
509
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
510
+ |------|------|------|--------|------|
511
+ | rating | number | 否 | 0 | 当前评分值 |
512
+ | indicator | boolean | 否 | false | 是否仅作为指示器(不可交互) |
513
+
514
+ **属性方法:**
515
+
516
+ | 方法 | 签名 | 默认值 | 说明 |
517
+ |------|------|--------|------|
518
+ | .stars | `.stars(value: number)` | 5 | 星星数 |
519
+ | .stepSize | `.stepSize(value: number)` | 0.5 | 步长 |
520
+ | .starStyle | `.starStyle(value: StarStyleOptions)` | — | 星星样式,StarStyleOptions:`{ backgroundUri: ResourceStr, foregroundUri: ResourceStr, secondaryUri?: ResourceStr }` |
521
+
522
+ **事件:**
523
+
524
+ | 事件 | 签名 | 说明 |
525
+ |------|------|------|
526
+ | .onChange | `.onChange(event: (value: number) => void)` | 评分变化 |
527
+
528
+ ---
529
+
530
+ ### LoadingProgress
531
+
532
+ 加载进度指示器。
533
+
534
+ **构造:** `LoadingProgress()`
535
+
536
+ **属性方法:**
537
+
538
+ | 方法 | 签名 | 默认值 | 说明 |
539
+ |------|------|--------|------|
540
+ | .color | `.color(value: ResourceColor)` | — | 颜色 |
541
+ | .enableLoading | `.enableLoading(value: boolean)` | true | 启用加载 |
542
+
543
+ ---
544
+
545
+ ### Search
546
+
547
+ 搜索框组件。
548
+
549
+ **构造:** `Search(options?: SearchOptions)`
550
+
551
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
552
+ |------|------|------|--------|------|
553
+ | value | ResourceStr | 否 | — | 搜索内容,支持 $$ |
554
+ | placeholder | ResourceStr | 否 | — | 占位文本 |
555
+ | icon | string | 否 | — | 搜索图标 |
556
+ | controller | SearchController | 否 | — | 控制器 |
557
+
558
+ **属性方法:**
559
+
560
+ | 方法 | 签名 | 默认值 | 说明 |
561
+ |------|------|--------|------|
562
+ | .searchButton | `.searchButton(value: ResourceStr, option?)` | — | 搜索按钮 |
563
+ | .placeholderColor | `.placeholderColor(value: ResourceColor)` | — | 占位符颜色 |
564
+ | .placeholderFont | `.placeholderFont(value?: Font)` | — | 占位符字体 |
565
+ | .textFont | `.textFont(value?: Font)` | — | 文本字体 |
566
+ | .textAlign | `.textAlign(value: TextAlign)` | — | 文本对齐 |
567
+ | .copyOption | `.copyOption(value: CopyOptions)` | — | 复制选项 |
568
+ | .searchIcon | `.searchIcon(value: SearchIconOptions)` | — | 搜索图标样式 |
569
+ | .cancelButton | `.cancelButton(value: CancelButtonOptions)` | — | 取消按钮样式 |
570
+ | .fontColor | `.fontColor(value: ResourceColor)` | — | 字体颜色 |
571
+ | .caretStyle | `.caretStyle(value: CaretStyle)` | - | API 10+ 光标样式。CaretStyle={width:Length默认2vp, color默认#ff007dff} |
572
+ | .selectedBackgroundColor | `.selectedBackgroundColor(value: ResourceColor)` | — | 选中底板色 |
573
+
574
+ **事件:**
575
+
576
+ | 事件 | 签名 | 说明 |
577
+ |------|------|------|
578
+ | .onSubmit | `.onSubmit(event: (value: string) => void)` | 提交搜索 |
579
+ | .onChange | `.onChange(event: (value: string) => void)` | 内容变化 |
580
+ | .onCopy | `.onCopy(event: (value: string) => void)` | 复制 |
581
+ | .onCut | `.onCut(event: (value: string) => void)` | 剪切 |
582
+
583
+ ---
584
+
585
+ ### Select
586
+
587
+ 下拉选择。
588
+
589
+ **构造:** `Select(options: Array<SelectOption>)`
590
+
591
+ > Select 构造器:`Select(options: Array<SelectOption>)`
592
+ > 每个 SelectOption:`{ value: string, icon?: ResourceStr, symbolIcon?: SymbolGlyphModifier }`
593
+ > ⚠️ 传数组不是传单个对象:`Select([{ value: 'A' }, { value: 'B' }])`
594
+
595
+ **SelectOption:**
596
+
597
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
598
+ |------|------|------|--------|------|
599
+ | value | ResourceStr | 是 | — | 选项文本 |
600
+ | icon | ResourceStr | 否 | — | 选项图标 |
601
+ | symbolIcon | SymbolGlyphModifier | 否 | — | 选项符号图标 |
602
+
603
+ **属性方法:**
604
+
605
+ | 方法 | 签名 | 默认值 | 说明 |
606
+ |------|------|--------|------|
607
+ | .selected | `.selected(value: number \| Resource)` | — | 选中索引 |
608
+ | .value | `.value(value: ResourceStr)` | — | 显示文本 |
609
+ | .controlSize | `.controlSize(value: ControlSize)` | — | 尺寸 |
610
+ | .font | `.font(value: Font)` | — | 字体 |
611
+ | .fontColor | `.fontColor(value: ResourceColor)` | — | 字体颜色 |
612
+ | .selectedOptionBgColor | `.selectedOptionBgColor(value: ResourceColor)` | — | 选中项背景色 |
613
+ | .selectedOptionFontColor | `.selectedOptionFontColor(value: ResourceColor)` | — | 选中项字体色 |
614
+ | .optionBgColor | `.optionBgColor(value: ResourceColor)` | — | 选项背景色 |
615
+ | .optionFontColor | `.optionFontColor(value: ResourceColor)` | — | 选项字体色 |
616
+ | .space | `.space(value: number)` | — | 间距 |
617
+
618
+ **事件:**
619
+
620
+ | 事件 | 签名 | 说明 |
621
+ |------|------|------|
622
+ | .onSelect | `.onSelect(event: (index: number, value?: string) => void)` | 选中回调 |
623
+
624
+ ---
625
+
626
+ ### 其他基础组件速查
627
+
628
+ | 组件 | 构造签名 | 属性方法 | 事件 |
629
+ |------|---------|---------|------|
630
+ | **Divider** | `Divider()` | `.vertical(bool)` `.color(color)` `.strokeWidth(Length)` `.lineCap(LineCapStyle)` | — |
631
+ | **Blank** | `Blank(min?: number\|string)` | `.color(ResourceColor)` | — |
632
+ | **Marquee** | `Marquee({start, step?:6, loop?:-1, fromStart?:true, src})` | `.fontColor()` `.fontSize()` `.fontWeight()` `.allowScale()` | `.onStart()` `.onBounce()` `.onFinish()` |
633
+ | **ImageAnimator** | `ImageAnimator()` | `.images(Array<ImageAnimatorInfo>)` `.state(AnimationStatus)` `.duration(number)` `.reverse(boolean)` `.fillMode(FillMode)` `.iterations(number)` | `.onStart()` `.onFinish()` `.onRepeat()` |
634
+ | **ToolBarItem** | `ToolBarItem(options?: {placement?, content?, icon?, action?})` | — API 20+ | — |
635
+ | **RichEditor** | `RichEditor({controller: RichEditorController})` | `.fontSize()` `.fontColor()` `.fontWeight()` | `.onReady()` `.onChange()` |
636
+
637
+ > **RichEditor 注意:** 必须传 `controller` 参数,不能空构造。`controller: RichEditorController = new RichEditorController()`
638
+
639
+ ### 通用方法注意事项
640
+
641
+ | 方法 | 签名 | 注意 |
642
+ |------|------|------|
643
+ | **.overlay** | `.overlay(value: CustomBuilder, options?)` | 必须传 @Builder 函数,不能直接传组件。正确:先定义 `@Builder overlayFn() { Text('label') }`,再 `.overlay(this.overlayFn)` |
644
+
645
+ ---