Vue directive plugin for text truncate. Plugin cuts too long text and replace it with ellipsis.
Install package in your project
$ npm install @sparing-software/v-clamp
Basic config in Vue app by global import plugin in main.js file
import Clamp from '@sparing-software/v-clamp'
Vue.use(Clamp)
All you need to do is add v-clamp directive to element on which you want to ellipsis overflow and specify its height or max-height style property.
Look at the example below:
<template>
<p v-clamp class="text">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
</template>
<style>
.text {
max-height: 100px;
}
</style>
Want to help improve this plugin? Great!
Project is open-source so fork repo and join us!
MIT License © Sparing Interactive