项目场景:
文字溢出要给个提示显示查看更多
解决方案:
<p class="topic-desc gey-text-color-light" id="desc">
简介:{{dataSource.fdIntroduction ? dataSource.fdIntroduction : '暂无'}}
</p>
data () {
return {
showMore: false
}
},
let width = document.getElementById('desc')
if (width.scrollHeight > width.offsetHeight) {
this.showMore = true
} else {
this.showMore = false
}