74、CSS——css 之 scss 变量的使用
<template>
<view class="textOverHid"
>测试文本测试文本测试文本测试文本测试文本测试文本测试文
本测试文本测试文本测试文本测试文本测试文本测试文本测试文
本测试文本测试文本测试文本测试文本测试文本测试文本测试文
本测试文本测试文本</view
>
</template>
<style lang="scss" scoped>
.textOverHid {
@include textOverHid();
}
</style>
uni.scss 文件
$row 表示 把块容器中的内容限制为指定的行数 可自行配置
@mixin textOverHid($width:100%, $row:2){
max-width: $width;
text-overflow: ellipsis;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: $row;
-webkit-box-orient: vertical;
}