控制显示较多文字后显示省略号

This commit is contained in:
Tim 2016-07-29 17:09:53 +08:00
parent 9a3acdd1db
commit b100651185
1 changed files with 1 additions and 1 deletions

View File

@ -14,7 +14,7 @@ app.directive('ellipsisShow',["$timeout",function(timer){
newContent = newContent + textSplit[i]; newContent = newContent + textSplit[i];
element.text(newContent); element.text(newContent);
if(element[0].scrollHeight >= 100){ if(element[0].scrollHeight >= 100){
newContent = newContent + textSplit[i+1] + textSplit[i+2] + textSplit[i+3] + textSplit[i+4] + "..."; newContent = newContent + textSplit[i+1] + textSplit[i+2] + textSplit[i+3] + textSplit[i+4] + textSplit[i+5] + textSplit[i+6] + textSplit[i+7] + textSplit[i+8] + textSplit[i+9] + textSplit[i+10] + "...";
element.text(newContent); element.text(newContent);
break; break;
} }