代码demo如下:
适用于WebKit浏览器内核<template> <div class="box"> 测试文本123测试文本123测试文本123测试文本123测试文本123测试文本123测试文本123测试文本123 </div></template><script> export default { }</script><style lang="less" scoped> .box { width: 150px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp:2; /*截取2行*/ -webkit-box-orient: vertical; }</style>