A filter for Vuejs to truncate string
Branch: master
Clone or download
Latest commit a22d65d Apr 23, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Aug 16, 2016
LICENSE Initial commit Aug 16, 2016
README.md docs(readme): add Greenkeeper badge Jul 7, 2017
package.json build: 1.1.7 Aug 25, 2017
vue-truncate.js

README.md

vue-truncate-filter

Greenkeeper badge

A filter for Vuejs to truncate string

Install:

CommonJS

Available through npm as vue-truncate-filter: npm install vue-truncate-filter --save

var VueTruncate = require('vue-truncate-filter')
Vue.use(VueTruncate)

Direct include

  • You can also directly include it with a <script> tag when you have Vue already included globally. It will automatically install itself, and will add a global VueTruncate.

Usage:

Vue 1.x

 {{ text | truncate 100 '....' }}

Vue 2.x

 {{ text | truncate(100) }}

Params:

  • length (Number): Text will be truncated if it's length is more than this param.

  • clamp (String) (default: ...): It will be added to end of text if it's truncated.

License

MIT