Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
02ab20b8
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
159
Star
292
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看板
未验证
提交
02ab20b8
编写于
4月 19, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 19, 2023
浏览文件
操作
浏览文件
下载
差异文件
!17032 支持轻量图文混排DOC
Merge pull request !17032 from limeng/imagespan
上级
23016423
5be7b43b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
99 addition
and
2 deletion
+99
-2
zh-cn/application-dev/reference/arkui-ts/figures/imagespan.png
.../application-dev/reference/arkui-ts/figures/imagespan.png
+0
-0
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imagespan.md
...n-dev/reference/arkui-ts/ts-basic-components-imagespan.md
+96
-0
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-text.md
...cation-dev/reference/arkui-ts/ts-basic-components-text.md
+3
-2
未找到文件。
zh-cn/application-dev/reference/arkui-ts/figures/imagespan.png
0 → 100644
浏览文件 @
02ab20b8
123.3 KB
zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imagespan.md
0 → 100644
浏览文件 @
02ab20b8
# ImageSpan
[
Text
](
ts-basic-components-text.md
)
组件的子组件,用于显示行内图片。
> **说明:**
>
> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 子组件
无
## 接口
ImageSpan(value: ResourceStr | PixelMap)
**参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 |
| -------- | -------- | -------- | -------- |
| value |
[
ResourceStr
](
ts-types.md#ResourceStr
)
\|
[PixelMap](../apis/js-apis-image.md#pixelmap7)
| 是 | 图片的数据源,支持本地图片和网络图片。
<br/>
当使用相对路径引用图片资源时,例如
`ImageSpan("common/test.jpg")`
,不支持跨包/跨模块调用该ImageSpan组件,建议使用
`$r`
方式来管理需全局使用的图片资源。
<br/>
\-
支持的图片格式包括png、jpg、bmp、svg和gif。
<br/>
\-
支持
`Base64`
字符串。格式
`data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`
, 其中
`[base64 data]`
为
`Base64`
字符串数据。
<br/>
\-
支持file:///data/storage路径前缀的字符串,用于读取本应用安装目录下files文件夹下的图片资源。需要保证目录包路径下的文件有可读权限。 |
## 属性
[
通用属性
](
ts-universal-attributes-size.md
)
方法仅支持宽(width)、高(height)和size。
| 名称 | 参数类型 | 描述 |
| -------- | -------- | -------- |
| verticalAlign |
[
ImageSpanAlignment
](
#imagespanalignment
)
| 图片基于文本的对齐方式。 |
| objectFit |
[
ImageFit
](
ts-appendix-enums.md#imagefit
)
| 设置图片的缩放类型。
<br/>
默认值:ImageFit.Cover |
## ImageSpanAlignment
| 名称 | 描述 |
| -------- | ------------------------------ |
| TOP | 图片上边沿与文本上边沿对齐。 |
| CENTER | 图片中间与文本中间对齐。 |
| BOTTOM | 图片下边沿与文本下边沿对齐。 |
| BASELINE | 图片下边沿与文本BaseLine对齐。 |
## 事件
通用事件仅支持
[
点击事件
](
ts-universal-attributes-click.md
)
。
## 示例
```
ts
// xxx.ets
@
Entry
@
Component
struct
SpanExample
{
build
()
{
Flex
({
direction
:
FlexDirection
.
Column
,
alignItems
:
ItemAlign
.
Start
})
{
Text
()
{
Span
(
'
This is the Span and ImageSpan component
'
).
fontSize
(
25
).
textCase
(
TextCase
.
Normal
)
.
decoration
({
type
:
TextDecorationType
.
None
,
color
:
Color
.
Pink
})
}.
width
(
'
100%
'
)
Text
()
{
ImageSpan
(
$r
(
'
app.media.icon
'
))
.
width
(
'
200px
'
)
.
height
(
'
200px
'
)
.
objectFit
(
ImageFit
.
Fill
)
.
verticalAlign
(
ImageSpanAlignment
.
CENTER
)
Span
(
'
I am LineThrough-span
'
)
.
decoration
({
type
:
TextDecorationType
.
LineThrough
,
color
:
Color
.
Red
}).
fontSize
(
25
)
ImageSpan
(
$r
(
'
app.media.icon
'
))
.
width
(
'
50px
'
)
.
height
(
'
50px
'
)
.
verticalAlign
(
ImageSpanAlignment
.
TOP
)
Span
(
'
I am Underline-span
'
)
.
decoration
({
type
:
TextDecorationType
.
Underline
,
color
:
Color
.
Red
}).
fontSize
(
25
)
ImageSpan
(
$r
(
'
app.media.icon
'
))
.
size
({
width
:
'
100px
'
,
height
:
'
100px
'
})
.
verticalAlign
(
ImageSpanAlignment
.
BASELINE
)
Span
(
'
I am Underline-span
'
)
.
decoration
({
type
:
TextDecorationType
.
Underline
,
color
:
Color
.
Red
}).
fontSize
(
25
)
ImageSpan
(
$r
(
'
app.media.icon
'
))
.
width
(
'
70px
'
)
.
height
(
'
70px
'
)
.
verticalAlign
(
ImageSpanAlignment
.
BOTTOM
)
Span
(
'
I am Underline-span
'
)
.
decoration
({
type
:
TextDecorationType
.
Underline
,
color
:
Color
.
Red
}).
fontSize
(
50
)
}
.
width
(
'
100%
'
)
.
backgroundColor
(
Color
.
Orange
)
.
textIndent
(
50
)
}.
width
(
'
100%
'
).
height
(
'
100%
'
).
padding
({
left
:
0
,
right
:
0
,
top
:
0
})
}
}
```

zh-cn/application-dev/reference/arkui-ts/ts-basic-components-text.md
浏览文件 @
02ab20b8
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
## 子组件
## 子组件
可以包含
[
Span
](
ts-basic-components-span.md
)
子组件。
可以包含
[
Span
](
ts-basic-components-span.md
)
和
[
ImageSpan
](
ts-basic-components-imagespan.md
)
子组件。
## 接口
## 接口
...
@@ -43,10 +43,11 @@ Text(content?: string | Resource)
...
@@ -43,10 +43,11 @@ Text(content?: string | Resource)
| copyOption
<sup>
9+
</sup>
|
[
CopyOptions
](
ts-appendix-enums.md#copyoptions9
)
| 组件支持设置文本是否可复制粘贴。
<br
/>
默认值:CopyOptions.None
<br/>
该接口支持在ArkTS卡片中使用。 |
| copyOption
<sup>
9+
</sup>
|
[
CopyOptions
](
ts-appendix-enums.md#copyoptions9
)
| 组件支持设置文本是否可复制粘贴。
<br
/>
默认值:CopyOptions.None
<br/>
该接口支持在ArkTS卡片中使用。 |
| textShadow
<sup>
10+
</sup>
|
[
ShadowOptions
](
ts-universal-attributes-image-effect.md#shadowoptions对象说明
)
| 设置文字阴影效果。 |
| textShadow
<sup>
10+
</sup>
|
[
ShadowOptions
](
ts-universal-attributes-image-effect.md#shadowoptions对象说明
)
| 设置文字阴影效果。 |
| heightAdaptivePolicy
<sup>
10+
</sup>
|
[
TextHeightAdaptivePolicy
](
ts-appendix-enums.md#TextHeightAdaptivePolicy10
)
| 设置文本自适应高度的方式。 |
| heightAdaptivePolicy
<sup>
10+
</sup>
|
[
TextHeightAdaptivePolicy
](
ts-appendix-enums.md#TextHeightAdaptivePolicy10
)
| 设置文本自适应高度的方式。 |
| textIndent
<sup>
10+
</sup>
| number
\|
string | 设置首行文本缩进,默认值0。 |
> **说明:**
> **说明:**
>
>
> 不支持Text内同时存在文本内容和Span
子组件。如果同时存在,只显示
Span内的内容。
> 不支持Text内同时存在文本内容和Span
或ImageSpan子组件。如果同时存在,只显示Span或Image
Span内的内容。
## 事件
## 事件
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录