项目作者: SparingSoftware

项目描述 :
Vue directive plugin for text truncate
高级语言: JavaScript
项目地址: git://github.com/SparingSoftware/v-clamp.git
创建时间: 2019-04-08T21:49:22Z
项目社区:https://github.com/SparingSoftware/v-clamp

开源协议:MIT License

下载



V-clamp :speech_balloon:



MIT license
Downloads number
JavaScript Style Guide

Vue directive plugin for text truncate.
Plugin cuts too long text and replace it with ellipsis.

Comparison basic multiline text-overflow and multiline text with use v-clamp directive

How to use

Installation

Install package in your project

  1. $ npm install @sparing-software/v-clamp

Configuration

Basic config in Vue app by global import plugin in main.js file

  1. import Clamp from '@sparing-software/v-clamp'
  2. Vue.use(Clamp)

Implementation

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:

  1. <template>
  2. <p v-clamp class="text">
  3. Lorem ipsum dolor sit amet, consectetur adipisicing elit.
  4. </p>
  5. </template>
  6. <style>
  7. .text {
  8. max-height: 100px;
  9. }
  10. </style>

Contributing

Want to help improve this plugin? Great!
Project is open-source so fork repo and join us!

License

MIT License © Sparing Interactive