vue版的:
wordlimit2:function(cname,wordlength){
var cname=document.getElementsByClassName(cname);
for(var i=0;i<cname.length;i++){
var nowLength=cname[i].innerHTML.length;
if(nowLength>wordlength){
cname[i].innerHTML=cname[i].innerHTML.substr(0,wordlength)+'...';
}
}
},
网友评论