Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
711ac6c4
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5942
Star
89
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
17
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
17
Issue
17
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
711ac6c4
编写于
8月 16, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(component): text \n
上级
58152aa3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
120 addition
and
98 deletion
+120
-98
pages/component/text/text-props.test.js
pages/component/text/text-props.test.js
+12
-0
pages/component/text/text-props.uvue
pages/component/text/text-props.uvue
+108
-98
未找到文件。
pages/component/text/text-props.test.js
0 → 100644
浏览文件 @
711ac6c4
const
PAGE_PATH
=
'
/pages/component/text/text-props
'
describe
(
'
text-props
'
,
()
=>
{
beforeAll
(
async
()
=>
{
const
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
1000
)
})
it
(
'
screenshot
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
({
fullPage
:
true
})
expect
(
image
).
toMatchImageSnapshot
()
})
})
pages/component/text/text-props.uvue
浏览文件 @
711ac6c4
<template>
<scroll-view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-title">
<text class="uni-title-text">text相关属性示例</text>
</view>
<scroll-view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-title">
<text class="uni-title-text">text相关属性示例</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">根据宽度自动折行</text>
</view>
<view class="text-box">
<text>{{multiLineText}}</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">\\n换行</text>
</view>
<view class="text-box">
<text>\n换\n行\n</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">根据宽度自动折行</text>
</view>
<view class="text-box">
<text>{{ multiLineText }}</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">截断(clip)</text>
</view>
<view class="text-box" style="height: 200rpx;">
<text class="uni-flex-item" style="text-overflow: clip;">{{multiLineText}}</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">截断(ellipsis)</text>
</view>
<view class="text-box" style="height: 200rpx;">
<text class="uni-flex-item" style="text-overflow: ellipsis;">{{multiLineText}}</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">\\n换行</text>
</view>
<view class="text-box">
<text>\n 换行</text>
<text>\\n 换行</text>
<text>\\\n 换行</text>
<text>\n 换行 \\n 换行 \\\n 换行 \\\\n 换行 \\\\\n 换行</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">selectable</text>
</view>
<view class="text-box">
<text :selectable="true">{{singleLineText}}</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">截断(clip)</text>
</view>
<view class="text-box" style="height: 200rpx">
<text class="uni-flex-item" style="text-overflow: clip">{{
multiLineText
}}</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">space</text>
<text class="uni-subtitle-text">依次为nbsp ensp emsp效果</text>
</view>
<view class="text-box">
<text space="nbsp">{{singleLineText}}</text>
<text space="ensp">{{singleLineText}}</text>
<text space="emsp">{{singleLineText}}</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">截断(ellipsis)</text>
</view>
<view class="text-box" style="height: 200rpx">
<text class="uni-flex-item" style="text-overflow: ellipsis">{{
multiLineText
}}</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">decode</text>
<text class="uni-subtitle-text">依次为lt gt amp apos nbsp ensp emsp效果</text>
</view>
<view class="text-box">
<text :decode="true">< > & '</text>
<text :decode="true">uni-app x,终极跨平台方案</text>
<text :decode="true">uni-app x,终极跨平台方案</text>
<text :decode="true">uni-app x,终极跨平台方案</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">嵌套</text>
</view>
<view class="text-box">
<text>一级节点黑色
<text style="color: red;">二级节点红色
<text>三级节点不继承二级的颜色</text>
</text>
<text style="font-size: 50px;">二级节点大字体</text>
</text>
</view>
</view>
</scroll-view>
<view class="uni-title">
<text class="uni-subtitle-text">selectable</text>
</view>
<view class="text-box">
<text :selectable="true">{{ singleLineText }}</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">space</text>
<text class="uni-subtitle-text">依次为nbsp ensp emsp效果</text>
</view>
<view class="text-box">
<text space="nbsp">{{ singleLineText }}</text>
<text space="ensp">{{ singleLineText }}</text>
<text space="emsp">{{ singleLineText }}</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">decode</text>
<text class="uni-subtitle-text"
>依次为lt gt amp apos nbsp ensp emsp效果</text
>
</view>
<view class="text-box">
<text :decode="true">< > & '</text>
<text :decode="true">uni-app x,终极跨平台方案</text>
<text :decode="true">uni-app x,终极跨平台方案</text>
<text :decode="true">uni-app x,终极跨平台方案</text>
</view>
<view class="uni-title">
<text class="uni-subtitle-text">嵌套</text>
</view>
<view class="text-box">
<text
>一级节点黑色
<text style="color: red"
>二级节点红色
<text>三级节点不继承二级的颜色</text>
</text>
<text style="font-size: 50px">二级节点大字体</text>
</text>
</view>
</view>
</scroll-view>
</template>
<script>
export default {
data() {
return {
title: 'text-props',
multiLineText: 'HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言;HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言',
singleLineText: 'uni-app x,终极跨平台方案'
}
},
methods: {
}
}
export default {
data() {
return {
title: 'text-props',
multiLineText:
'HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言;HBuilderX,轻巧、极速,极客编辑器;uni-app x,终极跨平台方案;uts,大一统语言',
singleLineText: 'uni-app x,终极跨平台方案',
}
},
methods: {},
}
</script>
<style>
.text-box {
margin-bottom: 40rpx;
padding: 40rpx 0;
display: flex;
background-color: #FFFFFF
;
justify-content: center;
align-items: center;
}
.text-box {
margin-bottom: 40rpx;
padding: 40rpx 0;
display: flex;
background-color: #ffffff
;
justify-content: center;
align-items: center;
}
.text {
font-size: 30rpx;
color: #353535;
line-height: 54rpx;
text-align: center;
}
</style>
\ No newline at end of file
.text {
font-size: 30rpx;
color: #353535;
line-height: 54rpx;
text-align: center;
}
</style>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录