filters.js 247 B

123456789
  1. import Vue from "vue"
  2. Vue.filter('shortenText',function(text, maxLength = 300){
  3. if(text && typeof text === 'string'){
  4. const finalChar = text.length > maxLength ? '...' : ''
  5. return text.substr(0, maxLength) + finalChar
  6. }
  7. return ''
  8. })