text-props.uvue 2.5 KB
Newer Older
DCloud-yinjiacheng's avatar
DCloud-yinjiacheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
<template>
	<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">截断(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">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">&lt; &gt; &amp; &apos;</text>
				<text :decode="true">uni-app&nbsp;x,终极跨平台方案</text>
				<text :decode="true">uni-app&ensp;x,终极跨平台方案</text>
				<text :decode="true">uni-app&emsp;x,终极跨平台方案</text>
			</view>
		</view>
	</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: {
			
		}
	}
</script>

<style>
	.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>