openComment.vue 1.7 KB
<template>
	<view>
		<view class="Express">
			<view class="info">
				<view :class="{hide:!iSinfo}" class="flexA">
					{{text}}
				</view>
				<view class="open" @tap="showinfo" v-if="!iSinfo & text.length>100">
					<view class="dot">...</view>
					全文
				</view>
			</view>
			<text @tap="showinfo" v-if="iSinfo" class="hidebtn">收起</text>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			text:{
				type:String,
				default:''
			}
		},
		data() {
			return {
				iSinfo: false
			}
		},
		methods: {
			showinfo() {
				this.iSinfo = !this.iSinfo
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #fff;
	}

	.Express {
		display: flex;
		flex-direction: column;
		background-color: #fff;
		position: relative;

		.info {
			display: flex;
			flex-direction: column;

			view {
				text-align: justify;
				font-size: 14px;
				font-weight: 400;
				color: rgba(102, 102, 102, 1);
				word-break: break-word; //换行模式
				background-color: #fff;
			}

			.open {
				width: 112rpx;
				font-size: 14px;
				display: flex;
				justify-content: flex-end;
				align-items: center;

				// background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 50%);
				color: #75CA42;
				position: absolute;
				bottom: 0upx;
				right: 0upx;

				.dot {
					margin-right: 30rpx;
				}
			}
		}

	}

	.hidebtn {
		display: flex;
		flex: 1;
		justify-content: flex-end;
		color: #75CA42;
		font-size: 14px;
	}

	.hide {
		word-break: break-word; //换行模式
		overflow: hidden;
		text-overflow: ellipsis; //修剪文字
		display: -webkit-box;
		-webkit-line-clamp: 3; //此处为上限行数
		-webkit-box-orient: vertical;
	}
</style>