vue slice words

Solutions on MaxInterview for vue slice words by the best coders in the world

showing results for - "vue slice words"
Julia
09 Jul 2020
1var filter = function(text, length, clamp){
2    clamp = clamp || '...';
3    var node = document.createElement('div');
4    node.innerHTML = text;
5    var content = node.textContent;
6    return content.length > length ? content.slice(0, length) + clamp : content;
7};
8
9Vue.filter('truncate', filter);
10
Lisa
17 Mar 2019
1{{data.content | truncate(300, '...')}}
2