小程序在 skyline 下如何开启多行省略

参考:https://developers.weixin.qq.com/community/develop/doc/000a648baacca06e83f1034d66c000

前言

小程序在 skyline 下不支持 line-clamp,想要开启多行省略使用 text 组件的 max-lines 结合 overflow 属性。

解决办法:skyline 下不支持 line-clamp,可以使用 text 组件的 max-lines 结合 overflow 属性使用。

拓展:

bash 复制代码
1. 内联文本只能用 text 组件,不能用 view,如 <text> foo <text>bar</text> </text>
2. 新增 span 组件用于内联文本和图片,如 <span> <image> </image> <text>bar</text> </span>

资料地址

https://developers.weixin.qq.com/miniprogram/dev/component/text.html

实例

html 复制代码
<view class="product-info">
  ......
  <text class="product-desc" overflow="ellipsis" max-lines="{{2}}">xxxxxxxxxx</text>
  ......
</view>
css 复制代码
.product-desc {
  font-size: 24rpx;
  color: #666;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 15rpx;
}
相关推荐
weixin_177297220695 小时前
旧物二手回收小程序:引领绿色消费,开启时尚生活新方式
小程序·盲盒
2501_916007476 小时前
Fastlane 结合 开心上架(Appuploader)命令行实现跨平台上传发布 iOS App 的完整方案
android·ios·小程序·https·uni-app·iphone·webview
韩立学长7 小时前
【开题答辩实录分享】以《植物病虫害在线答疑小程序的设计与实现》为例进行答辩实录分享
spring boot·小程序·vue
好想早点睡.8 小时前
vue2+UniApp微信小程序集成高德地图
微信小程序·小程序·uni-app
2501_9159184110 小时前
iOS 上架应用市场全流程指南,App Store 审核机制、证书管理与跨平台免 Mac 上传发布方案(含开心上架实战)
android·macos·ios·小程序·uni-app·cocoa·iphone
Mr.Aholic11 小时前
分享几个开源的系统,包括小程序、商城系统、二手交易等常见的系统、很容易进行二次开发 【可以参考学习】
微信小程序·小程序·毕业设计·课程设计
2501_9159090612 小时前
HTTPS 错误排查实战,从握手到应用层的工程化流程
网络协议·http·ios·小程序·https·uni-app·iphone
JIngJaneIL16 小时前
口腔健康系统|口腔医疗|基于java和小程序的口腔健康系统小程序设计与实现(源码+数据库+文档)
java·数据库·spring boot·小程序·论文·毕设·口腔医疗小程序
小光学长1 天前
基于微信小程序的背单词系统x1o5sz72(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
数据库·微信小程序·小程序
晨旭缘1 天前
解决小程序样式隔离styleIsolation
小程序