<div id="content">
若干文字内容
</div>
getLineCount () {
const style = window.getComputedStyle(document.getElementById('content'), null);
const fontSize = style.fontSize;
const paddingTop = style.paddingTop.replace('px', '');
const paddingBottom = style.paddingBottom.replace('px', '');
const lineHeight = (style.lineHeight === 'normal' ? fontSize : style.lineHeight).replace('px', '');
const height = style.height.replace('px', '');
debugger;
if (height / lineHeight > this.lineLimit) {
this.isNeedShowMore = true;
} else {
this.isNeedShowMore = false;
}
console.log(height / lineHeight);
}