Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imcvampire/vue-truncate-filter
A filter for Vuejs to truncate string
https://github.com/imcvampire/vue-truncate-filter
hacktoberfest
Last synced: 3 months ago
JSON representation
A filter for Vuejs to truncate string
- Host: GitHub
- URL: https://github.com/imcvampire/vue-truncate-filter
- Owner: imcvampire
- License: mit
- Created: 2016-08-16T02:45:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-22T18:54:19.000Z (almost 7 years ago)
- Last Synced: 2024-11-01T02:21:40.465Z (3 months ago)
- Topics: hacktoberfest
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 57
- Watchers: 6
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-vue - vue-truncate-filter - 截断字符串的VueJS过滤器 (实用库)
- awesome-github-vue - vue-truncate-filter - 截断字符串的VueJS过滤器 (实用库)
- awesome - vue-truncate-filter - 截断字符串的VueJS过滤器 (实用库)
- awesome-vue - vue-truncate-filter - truncate-filter?style=social) - 截断字符串的VueJS过滤器 (实用库)
README
# vue-truncate-filter
[![Greenkeeper badge](https://badges.greenkeeper.io/imcvampire/vue-truncate-filter.svg)](https://greenkeeper.io/)
A filter for Vuejs to truncate string
## Install:
### CommonJS
Available through npm as `vue-truncate-filter`: `npm install vue-truncate-filter --save`
``` js
var VueTruncate = require('vue-truncate-filter')
Vue.use(VueTruncate)
```### Direct include
- You can also directly include it with a `` tag when you have Vue already included globally. It will automatically install itself, and will add a global `VueTruncate`.
## Usage:
### Vue 1.x
```html
{{ text | truncate 100 '....' }}
```
### Vue 2.x
```html
{{ 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](http://opensource.org/licenses/MIT)