toggle substring with vue js code example
Example 1: vue truncate text
filters: {
truncate: function (text, length, suffix) {
if (text.length > length) {
return text.substring(0, length) + suffix;
} else {
return text;
}
},
}
Example 2: vue slice words
{{data.content | truncate(300, '...')}}