Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
fe9869f0
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fe9869f0
编写于
10月 09, 2022
作者:
M
match
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
示例文档整改
Signed-off-by:
N
match
<
zhouqingfeng2@huawei.com
>
上级
586842ae
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
151 addition
and
98 deletion
+151
-98
zh-cn/application-dev/reference/arkui-ts/figures/gradientColor1.png
...ication-dev/reference/arkui-ts/figures/gradientColor1.png
+0
-0
zh-cn/application-dev/reference/arkui-ts/figures/gradientColor2.png
...ication-dev/reference/arkui-ts/figures/gradientColor2.png
+0
-0
zh-cn/application-dev/reference/arkui-ts/figures/gradientColor3.png
...ication-dev/reference/arkui-ts/figures/gradientColor3.png
+0
-0
zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219864149.png
...ference/arkui-ts/figures/zh-cn_image_0000001219864149.png
+0
-0
zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md
.../reference/arkui-ts/ts-universal-attributes-background.md
+3
-5
zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md
...eference/arkui-ts/ts-universal-attributes-component-id.md
+73
-79
zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md
...erence/arkui-ts/ts-universal-attributes-gradient-color.md
+75
-14
未找到文件。
zh-cn/application-dev/reference/arkui-ts/figures/gradientColor1.png
0 → 100644
浏览文件 @
fe9869f0
23.5 KB
zh-cn/application-dev/reference/arkui-ts/figures/gradientColor2.png
0 → 100644
浏览文件 @
fe9869f0
80.5 KB
zh-cn/application-dev/reference/arkui-ts/figures/gradientColor3.png
0 → 100644
浏览文件 @
fe9869f0
101.3 KB
zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219864149.png
已删除
100644 → 0
浏览文件 @
586842ae
28.3 KB
zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-background.md
浏览文件 @
fe9869f0
# 背景设置
设置组件的背景
色
。
设置组件的背景
样式
。
> **说明:**
>
> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 属性
| 名称 | 参数类型 | 描述 |
| -------- | -------- | -------- |
| backgroundColor |
[
ResourceColor
](
ts-types.md#resourcecolor
)
| 设置组件的背景色。 |
| backgroundImage | src:
[ResourceStr](ts-types.md#resourcestr),
<br/>
repeat?:
[
ImageRepeat
](
ts-appendix-enums.md#imagerepeat
)
| src:图片地址,支持网络图片资源和本地图片资源地址(不支持svg类型的图片)。
<br/>
repeat:设置背景图片的重复样式,默认不重复。 |
| backgroundImageSize | {
<br/>
width?:
[Length](ts-types.md#length),
<br/>
height?:
[Length](ts-types.md#length)
<br/>
}
\|
[
ImageSize
](
ts-appendix-enums.md#imagesize
)
| 设置背景图像的高度和宽度。当输入为{width:
Length,
height:
Length}对象时,如果只设置一个属性,则第二个属性保持图片原始宽高比进行调整。默认保持原图的比例不变。
<br/>
默认值:ImageSize.Auto |
| backgroundImagePosition | {
<br/>
x?:
[Length](ts-types.md#length),
<br/>
y?:
[Length](ts-types.md#length)
<br/>
}
\|
[
Alignment
](
ts-appendix-enums.md#alignment
)
| 设置背景图在组件中显示位置。
<br/>
{
<br/>
x:
0,
<br/>
y:
0
<br/>
} |
| backgroundImagePosition |
[
Position
](
ts-types.md#position8
)
\|
[
Alignment
](
ts-appendix-enums.md#alignment
)
| 设置背景图在组件中显示位置。
<br/>
默认值:
<br/>
{
<br/>
x:
0,
<br/>
y:
0
<br/>
} |
## 示例
...
...
@@ -25,6 +22,7 @@
@
Entry
@
Component
struct
BackgroundExample
{
build
()
{
Column
({
space
:
5
})
{
Text
(
'
background color
'
).
fontSize
(
9
).
width
(
'
90%
'
).
fontColor
(
0xCCCCCC
)
...
...
zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md
浏览文件 @
fe9869f0
...
...
@@ -4,19 +4,14 @@ id为组件的唯一标识,在整个应用内唯一。本模块提供组件标
> **说明:**
>
> - 从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 权限列表
无
> 从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 属性
| 名称
| 参数说明 | 默认值 | 描述
|
| ----
| -------- | ------ | -------
----------------------------- |
| id | string |
'' | 组件的唯一标识,唯一性由使用者保证。
|
| 名称
| 参数说明 | 描述
|
| ----
-| -------- |
----------------------------- |
| id | string |
组件的唯一标识,唯一性由使用者保证。
<br>
默认值:''
|
## 接口
...
...
@@ -27,106 +22,104 @@ id为组件的唯一标识,在整个应用内唯一。本模块提供组件标
getInspectorByKey(id: string): string
获取指定id的组件的所有属性,不包括子组件信息。
此接口为系统接口。
-
参数
| 参数 | 类型 | 必填 | 默认值 | 描述 |
| ---- | ------ | ---- | ---- | ----------- |
| id | string | 是 | - | 要获取属性的组件id。 |
**参数:**
| 参数 | 类型 | 必填 | 描述 |
| ---- | -------- | ---- | -------------|
| id | string | 是 | 要获取属性的组件id。 |
-
返回值
| 类型 | 描述 |
| ------ | --------------- |
| string | 组件属性列表的JSON字符串。 |
**返回值:**
| 类型 | 描述 |
| -------| -------------- |
| string | 组件属性列表的JSON字符串。 |
### getInspectorTree
getInspectorTree(): string
获取组件树及组件属性。
此接口为系统接口。
-
返回值
**返回值:**
| 类型 | 描述
|
| ------ |
------------------- |
| string | 组件树及组件属性列表的JSON字符串。 |
| 类型 | 描述
|
| ------ | --------
------------------- |
| string | 组件树及组件属性列表的JSON字符串。 |
### sendEventByKey
sendEventByKey(id: string, action: number, params: string): boolean
给指定id的组件发送事件。
此接口为系统接口。
-
参数
| 参数 | 类型 | 必填 | 默认值 | 描述 |
| ------ | ------ | ---- | ---- | ---------------------------------------- |
| id | string | 是 | - | 要触发事件的组件的id。 |
| action | number | 是 | - | 要触发的事件类型,目前支持取值:
<br/>
-
点击事件Click:
10
<br/>
-
长按事件LongClick:
11。 |
| params | string | 是 | - | 事件参数,无参数传空字符串
""。 |
**参数:**
| 参数 | 类型 | 必填 | 描述 |
| ------ | -------| ---- | -------------------------- |
| id | string | 是 | 要触发事件的组件的id。 |
| action | number | 是 | 要触发的事件类型,目前支持取值:
<br/>
-
点击事件Click:
10
<br/>
-
长按事件LongClick:
11。 |
| params | string | 是 | 事件参数,无参数传空字符串
""。 |
**返回值:**
-
返回值
| 类型 | 描述 |
| ------- | ------------------------------ |
| boolean | 找不到指定id的组件时返回false,其余情况返回true。 |
| 类型 | 描述 |
| -------- | --------------------------|
| boolean | 找不到指定id的组件时返回false,其余情况返回true。 |
### sendTouchEvent
sendTouchEvent(event: TouchObject): boolean
发送触摸事件。
此接口为系统接口。
-
参数
**参数:**
| 参数 | 类型 | 必填 | 默认值 | 描述
|
| ----- | ----------- | ---- | ---- |
---------------------------------------- |
| event | TouchObject | 是 | -
| 触发触摸事件的位置,event参数见
[
TouchEvent
](
ts-universal-events-touch.md#touchevent对象说明
)
中TouchObject的介绍。 |
| 参数 | 类型 | 必填 | 描述
|
| ----- | ----------- | ---- | --------------------
---------------------------------------- |
| event |
[
TouchObject
](
ts-universal-events-touch.md#touchobject对象说明
)
| 是
| 触发触摸事件的位置,event参数见
[
TouchEvent
](
ts-universal-events-touch.md#touchevent对象说明
)
中TouchObject的介绍。 |
-
返回值
**返回值:**
| 类型 | 描述 |
| ------- | --------------------------
|
| boolean | 事件发送失败时返回false,其余情况返回true。 |
| 类型 | 描述 |
| ------- | ---------------------------
|
| boolean | 事件发送失败时返回false,其余情况返回true。 |
### sendKeyEvent
sendKeyEvent(event: KeyEvent): boolean
发送按键事件。
此接口为系统接口。
-
参数
**参数:**
| 参数 | 类型 | 必填 | 默认值 | 描述
|
| ----- | -------- | ---- | ---- |
---------------------------------------- |
| event | KeyEvent | 是 | -
| 按键事件,event参数见
[
KeyEvent
](
ts-universal-events-key.md#keyevent对象说明
)
介绍。 |
| 参数 | 类型 | 必填 | 描述
|
| ----- | -------- | ---- | --------------------
---------------------------------------- |
| event |
[
KeyEvent
](
ts-universal-events-key.md#keyevent对象说明
)
| 是
| 按键事件,event参数见
[
KeyEvent
](
ts-universal-events-key.md#keyevent对象说明
)
介绍。 |
-
返回值
**返回值:**
| 类型 | 描述
|
| ------- | ---------------------------
|
| boolean | 事件发送失败时时返回false,其余情况返回true。 |
| 类型 | 描述
|
| ------- | ------------------------------
|
| boolean | 事件发送失败时时返回false,其余情况返回true。 |
### sendMouseEvent
sendMouseEvent(event: MouseEvent): boolean
发送鼠标事件。
此接口为系统接口。
-
参数
**参数:**
| 参数 | 类型 | 必填 | 默认值 | 描述
|
| ----- | ---------- | ---- | ---- | -
--------------------------------------- |
| event | MouseEvent | 是 | -
| 鼠标事件,event参数见
[
MouseEvent
](
ts-universal-mouse-key.md#mouseevent对象说明
)
介绍。 |
| 参数 | 类型 | 必填 | 描述
|
| ----- | ---------- | ---- |
--------------------------------------- |
| event |
[
MouseEvent
](
ts-universal-mouse-key.md#mouseevent对象说明
)
| 是
| 鼠标事件,event参数见
[
MouseEvent
](
ts-universal-mouse-key.md#mouseevent对象说明
)
介绍。 |
-
返回值
**返回值:**
| 类型 | 描述
|
| ------- |
--------------------------- |
| boolean | 事件发送失败时
时返回false,其余情况返回true。 |
| 类型 | 描述
|
| ------- | -------
--------------------------- |
| boolean | 事件发送失败
时返回false,其余情况返回true。 |
## 示例
...
...
@@ -139,6 +132,7 @@ class Utils {
static
rect_bottom
;
static
rect_value
;
//获取组件所占矩形区域坐标
static
getComponentRect
(
key
)
{
let
strJson
=
getInspectorByKey
(
key
);
let
obj
=
JSON
.
parse
(
strJson
);
...
...
@@ -178,32 +172,32 @@ struct IdExample {
console
.
info
(
getInspectorTree
())
this
.
text
=
"
Button 'click to start' is clicked
"
setTimeout
(()
=>
{
sendEventByKey
(
"
long
click
"
,
11
,
""
)
sendEventByKey
(
"
long
Click
"
,
11
,
""
)
// 向id为"longClick"的组件发送长按事件
},
2000
)
}).
id
(
'
click
'
)
Button
()
{
Text
(
'
long
c
lick
'
).
fontSize
(
25
).
fontWeight
(
FontWeight
.
Bold
)
Text
(
'
long
C
lick
'
).
fontSize
(
25
).
fontWeight
(
FontWeight
.
Bold
)
}.
margin
({
top
:
20
}).
backgroundColor
(
'
#0D9FFB
'
)
.
gesture
(
LongPressGesture
().
onActionEnd
(()
=>
{
console
.
info
(
'
long clicked
'
)
this
.
text
=
"
Button 'long
c
lick' is longclicked
"
this
.
text
=
"
Button 'long
C
lick' is longclicked
"
setTimeout
(()
=>
{
let
rect
=
Utils
.
getComponentRect
(
'
onTouch
'
)
let
rect
=
Utils
.
getComponentRect
(
'
onTouch
'
)
// 获取id为"onTouch"组件的矩形区域坐标
let
touchPoint
:
TouchObject
=
{
id
:
1
,
x
:
rect
.
left
+
(
rect
.
right
-
rect
.
left
)
/
2
,
y
:
rect
.
top
+
(
rect
.
bottom
-
rect
.
top
)
/
2
,
x
:
rect
.
left
+
(
rect
.
right
-
rect
.
left
)
/
2
,
// 组件中心点x坐标
y
:
rect
.
top
+
(
rect
.
bottom
-
rect
.
top
)
/
2
,
// 组件中心点y坐标
type
:
TouchType
.
Down
,
screenX
:
rect
.
left
+
(
rect
.
right
-
rect
.
left
)
/
2
,
screenY
:
rect
.
left
+
(
rect
.
right
-
rect
.
left
)
/
2
,
screenX
:
rect
.
left
+
(
rect
.
right
-
rect
.
left
)
/
2
,
// 组件中心点x坐标
screenY
:
rect
.
left
+
(
rect
.
right
-
rect
.
left
)
/
2
,
// 组件中心点y坐标
}
sendTouchEvent
(
touchPoint
)
sendTouchEvent
(
touchPoint
)
// 发送触摸事件
touchPoint
.
type
=
TouchType
.
Up
sendTouchEvent
(
touchPoint
)
sendTouchEvent
(
touchPoint
)
// 发送触摸事件
},
2000
)
})).
id
(
'
long
c
lick
'
)
})).
id
(
'
long
C
lick
'
)
Button
()
{
Text
(
'
onTouch
'
).
fontSize
(
25
).
fontWeight
(
FontWeight
.
Bold
)
...
...
@@ -212,14 +206,14 @@ struct IdExample {
console
.
info
(
'
onTouch is clicked
'
)
this
.
text
=
"
Button 'onTouch' is clicked
"
setTimeout
(()
=>
{
let
rect
=
Utils
.
getComponentRect
(
'
onMouse
'
)
let
rect
=
Utils
.
getComponentRect
(
'
onMouse
'
)
// 获取id为"onMouse"组件的矩形区域坐标
let
mouseEvent
:
MouseEvent
=
{
button
:
MouseButton
.
Left
,
action
:
MouseAction
.
Press
,
x
:
rect
.
left
+
(
rect
.
right
-
rect
.
left
)
/
2
,
y
:
rect
.
top
+
(
rect
.
bottom
-
rect
.
top
)
/
2
,
screenX
:
rect
.
left
+
(
rect
.
right
-
rect
.
left
)
/
2
,
screenY
:
rect
.
top
+
(
rect
.
bottom
-
rect
.
top
)
/
2
,
x
:
rect
.
left
+
(
rect
.
right
-
rect
.
left
)
/
2
,
// 组件中心点x坐标
y
:
rect
.
top
+
(
rect
.
bottom
-
rect
.
top
)
/
2
,
// 组件中心点y坐标
screenX
:
rect
.
left
+
(
rect
.
right
-
rect
.
left
)
/
2
,
// 组件中心点x坐标
screenY
:
rect
.
top
+
(
rect
.
bottom
-
rect
.
top
)
/
2
,
// 组件中心点y坐标
timestamp
:
1
,
target
:
{
area
:
{
...
...
@@ -237,7 +231,7 @@ struct IdExample {
},
source
:
SourceType
.
Mouse
}
sendMouseEvent
(
mouseEvent
)
sendMouseEvent
(
mouseEvent
)
// 发送鼠标事件
},
2000
)
}).
id
(
'
onTouch
'
)
...
...
@@ -257,7 +251,7 @@ struct IdExample {
metaKey
:
0
,
timestamp
:
0
}
sendKeyEvent
(
keyEvent
)
sendKeyEvent
(
keyEvent
)
// 发送按键事件
},
2000
)
}).
id
(
'
onMouse
'
)
...
...
zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md
浏览文件 @
fe9869f0
# 颜色渐变
设置组件的颜色渐变效果。
> **说明:**
>
> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 权限列表
无
## 属性
| 名称
| 参数类型 | 默认值 | 描述
|
| --------
| -------- | -------- |
-------- |
| linearGradient | {
<br/>
angle?:
number
\|
string,
<br/>
direction?:
[GradientDirection](ts-appendix-enums.md#gradientdirection),
<br/>
colors:
Array
<
[ColorStop](ts-basic-components-gauge.md#colorstop)
>
,
<br/>
repeating?:
boolean
<br/>
} |
- | 线性渐变。
<br/>
angle:
线性渐变的角度。
<br/>
direction:
线性渐变的方向,设置angle后不生效。
<br/>
colors:
为渐变的颜色描述。
<br/>
repeating:
为渐变的颜色重复着色。
|
| sweepGradient
| {
<br/>
center:
Point,
<br/>
start?:
number
\|
string,
<br/>
end?:
number
\|
string,
<br/>
rotation?:
number\|string,
<br/>
colors:
Array
<
[ColorStop](ts-basic-components-gauge.md#colorstop)
>
,
<br/>
repeating?:
boolean
<br/>
} | - | 角度渐变。
<br/>
center:为角度渐变的中心点。
<br/>
start:角度渐变的起点。
<br/>
end:角度渐变的终点。
<br/>
rotation:
角度渐变的旋转角度。
<br/>
colors:
为渐变的颜色描述。
<br/>
repeating:
为渐变的颜色重复着色。
|
| radialGradient | {
<br/>
center:
Point,
<br/>
radius:
number
\|
string,
<br/>
colors:
Array
<
[ColorStop](ts-basic-components-gauge.md#colorstop)
>
,
<br/>
repeating?:
boolean
<br/>
} | - | 径向渐变。
<br/>
center:径向渐变的中心点。
<br/>
radius:径向渐变的半径。
<br/>
colors:
为渐变的颜色描述。
<br/>
repeating:
为渐变的颜色重复着色。
|
| 名称
| 参数类型 | 描述
|
| --------
------ | -------------------------------------------- | ---------------------------
-------- |
| linearGradient | {
<br/>
angle?:
number
\|
string,
<br/>
direction?:
[GradientDirection](ts-appendix-enums.md#gradientdirection),
<br/>
colors:
Array
<
[ColorStop](ts-basic-components-gauge.md#colorstop)
>
,
<br/>
repeating?:
boolean
<br/>
} |
线性渐变。
<br/>
- angle:
线性渐变的起始角度。0点方向顺时针旋转为正向角度。
<br/>
默认值:180
<br/>
- direction:
线性渐变的方向,设置angle后不生效。
<br/>
默认值:GradientDirection.Bottom
<br/>
- colors:
为渐变的颜色描述。
<br/>
- repeating:
为渐变的颜色重复着色。
<br/>
默认值:false
|
| sweepGradient
| {
<br/>
center:
Point,
<br/>
start?:
number
\|
string,
<br/>
end?:
number
\|
string,
<br/>
rotation?:
number\|string,
<br/>
colors:
Array
<
[ColorStop](ts-basic-components-gauge.md#colorstop)
>
,
<br/>
repeating?:
boolean
<br/>
} | 角度渐变。
<br/>
- center:为角度渐变的中心点,即相对于当前组件左上角的坐标。
<br/>
- start:角度渐变的起点。
<br/>
默认值:0
<br/>
- end:角度渐变的终点。
<br/>
默认值:0
<br/>
- rotation:
角度渐变的旋转角度。
<br/>
默认值:0
<br/>
- colors:
为渐变的颜色描述。
<br/>
- repeating:
为渐变的颜色重复着色。
<br/>
默认值:false
|
| radialGradient | {
<br/>
center:
Point,
<br/>
radius:
number
\|
string,
<br/>
colors:
Array
<
[ColorStop](ts-basic-components-gauge.md#colorstop)
>
,
<br/>
repeating?:
boolean
<br/>
} | 径向渐变。
<br/>
- center:径向渐变的中心点,即相对于当前组件左上角的坐标。
<br/>
- radius:径向渐变的半径。
<br/>
- colors:
为渐变的颜色描述。
<br/>
- repeating:
为渐变的颜色重复着色。
<br/>
默认值:false
|
## 示例
...
...
@@ -34,8 +32,32 @@ struct ColorGradientExample {
.
height
(
50
)
.
linearGradient
({
angle
:
90
,
colors
:
[[
0xAEE1E1
,
0.0
],
[
0xD3E0DC
,
0.3
],
[
0xFCD1D1
,
1.0
]]
colors
:
[[
0xff0000
,
0.0
],
[
0x0000ff
,
0.3
],
[
0xffff00
,
1.0
]]
})
Text
(
'
linearGradient Repeat
'
).
fontSize
(
12
).
width
(
'
90%
'
).
fontColor
(
0xCCCCCC
)
Row
()
.
width
(
'
90%
'
)
.
height
(
50
)
.
linearGradient
({
direction
:
GradientDirection
.
Left
,
// 渐变方向
repeating
:
true
,
// 渐变颜色是否重复
colors
:
[[
0xff0000
,
0.0
],
[
0x0000ff
,
0.3
],
[
0xffff00
,
0.5
]]
// 数组末尾元素占比小于1时满足重复着色效果
})
}
.
width
(
'
100%
'
)
.
padding
({
top
:
5
})
}
}
```

```
ts
@
Entry
@
Component
struct
ColorGradientExample
{
build
()
{
Column
({
space
:
5
})
{
Text
(
'
sweepGradient
'
).
fontSize
(
12
).
width
(
'
90%
'
).
fontColor
(
0xCCCCCC
)
Row
()
.
width
(
100
)
...
...
@@ -44,8 +66,37 @@ struct ColorGradientExample {
center
:
[
50
,
50
],
start
:
0
,
end
:
359
,
colors
:
[[
0xAEE1E1
,
0.0
],
[
0xD3E0DC
,
0.3
],
[
0xFCD1D1
,
1.0
]]
colors
:
[[
0xff0000
,
0.0
],
[
0x0000ff
,
0.3
],
[
0xffff00
,
1.0
]]
})
Text
(
'
sweepGradient Reapeat
'
).
fontSize
(
12
).
width
(
'
90%
'
).
fontColor
(
0xCCCCCC
)
Row
()
.
width
(
100
)
.
height
(
100
)
.
sweepGradient
({
center
:
[
50
,
50
],
start
:
0
,
end
:
359
,
rotation
:
45
,
// 旋转角度
repeating
:
true
,
// 渐变颜色是否重复
colors
:
[[
0xff0000
,
0.0
],
[
0x0000ff
,
0.3
],
[
0xffff00
,
0.5
]]
// 数组末尾元素占比小于1时满足重复着色效果
})
}
.
width
(
'
100%
'
)
.
padding
({
top
:
5
})
}
}
```

```
ts
// xxx.ets
@
Entry
@
Component
struct
ColorGradientExample
{
build
()
{
Column
({
space
:
5
})
{
Text
(
'
radialGradient
'
).
fontSize
(
12
).
width
(
'
90%
'
).
fontColor
(
0xCCCCCC
)
Row
()
.
width
(
100
)
...
...
@@ -53,7 +104,17 @@ struct ColorGradientExample {
.
radialGradient
({
center
:
[
50
,
50
],
radius
:
60
,
colors
:[[
0xAEE1E1
,
0.0
],
[
0xD3E0DC
,
0.3
],
[
0xFCD1D1
,
1.0
]]
colors
:
[[
0xff0000
,
0.0
],
[
0x0000ff
,
0.3
],
[
0xffff00
,
1.0
]]
})
Text
(
'
radialGradient Repeat
'
).
fontSize
(
12
).
width
(
'
90%
'
).
fontColor
(
0xCCCCCC
)
Row
()
.
width
(
100
)
.
height
(
100
)
.
radialGradient
({
center
:
[
50
,
50
],
radius
:
60
,
repeating
:
true
,
colors
:
[[
0xff0000
,
0.0
],
[
0x0000ff
,
0.3
],
[
0xffff00
,
0.5
]]
// 数组末尾元素占比小于1时满足重复着色效果
})
}
.
width
(
'
100%
'
)
...
...
@@ -62,4 +123,4 @@ struct ColorGradientExample {
}
```


编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录