表格列表内容太多以...结尾

参考:https://blog.csdn.net/bigbear00007/article/details/80111967

cutsubstr(str, len) {
        if (!str || !len) { return ''; }
        let build = '';
        for (let i = 0; i < str.length && len > 0; i++) {
            build += str.substr(i, 1);
            len -= str.charCodeAt(i) > 127 ? 2 : 1;
        }
        if (build.length < str.length)
            build += '...';
        return build;
    },

 

posted on 2024-07-26 18:11  技术高超  阅读(1)  评论(0编辑  收藏  举报