这里讲一下,如何使用某视频剪辑软件控制多行文字展开收起(也叫控制文字展开隐藏)。
效果:
这里设置了控制三行,如果超过三行会展示,"显示更多"超出文字显示省略号。点击"显示更多"会展开所有文案,按钮变成"收起"
(未超出三行的时候)
(展开)
(收起)
代码实现:
模板div p class=' m-内容溢出-line ' id=' J _ description ' { introduction } }/p button type=' button ' class=' BTN-more ' v-if=' is show more ' id=' J _ btm more ' @ click=' show more desc($ event ')查看更多/button /div/templatescript导出默认值{ name: 'Spread ',data(){ return { is samore : false,isDescStatus: true,introduce : ' ' };},prop : { mes 2: { type : String,default: '' },methods : { showmoreDesc(e){ let El=e . CurrentTarget;埃尔。previouselementsiblind。类列表[!this.isDescStatus?添加":"移除"]"("溢出行");el.classList[this.isDescStatus?添加":"移除"]"(" more-collapse ");el.innerHTML=!this.isDescStatus?'查看更多' : '收起;this.isDescStatus=!this.isDescStatusthat。是显多=真;} },观看: { mes2(val){ this。简介=val如果(这个。引言。长度75){这个。isshow more=true} } } };/scriptstyle lang='less '范围m .内容{。溢出行{ display :-web工具包-box;-网络套件-面向盒子的:垂直;-网套件-线夹: 3;飞越:隐藏;} } .BTN-更多{ color : # fff向右浮动:颜色: # 5383E7相对位置:保证金-top : RC(5);填充-右侧: RC(33);更多-折叠{ :after,before { top: 2px变压器: 旋转(180度);} :前{ top: 4px } } :after后,后{ width : 0;高度: 0;内容: " ";绝对位置:右: 0;top: 7pxborder: rc(12)固体透明;} : {边框-顶部-颜色: # 5383 E7z-index : 1;} :在{边框-顶部-颜色: # 1c 2239z-index : 2;top: 5px} }/样式使用组件
展宽:mes2='需要传递的文字数据/扩散以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。