企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
# html `{{v.content|textLengthSet:true:115:' ...'}}` # js ~~~ angular.module('example').filter('textLengthSet', function() { return function(value, wordwise, max, tail) { if (!value) return ''; max = parseInt(max, 10); if (!max) return value; if (value.length <= max) return value; value = value.substr(0, max); if (wordwise) { var lastspace = value.lastIndexOf(' '); if (lastspace != -1) { value = value.substr(0, lastspace); } } return value + (tail || ' …');//'...'可以换成其它文字 }; }); ~~~