vue-cut
is a plugin for Vue component.
This plugin support for adjust the text length of some element.
> npm install vue-cut
> yarn add vue-cut
import Vue from 'vue';
import VueCut from 'vue-cut';
Vue.use(VueCut);
Attach v-cut
directive to any tag which has text contents.
Pass the number value which adjust length to len
.
And pass the string value to trail
if you add some text at trail of contents.
<template>
<div v-cut="{ len: 50, trail: '...' }">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</template>
Code released under MIT license.