@clampy-js/vue-clampy

Vue.js (2+) directive that clamps the content of an element by adding an ellipsis to it if the content inside is too long.
22,501 75
Install
npm install @clampy-js/vue-clampy
Latest Version:1.0.6
Vue:2
License:MIT
Last Updated:Sep 18, 2020
Links: GitHub  ·  npm
Maintainer: alexandre.moore

vue-clampy

Build Status GitHub issues GitHub license npm

Vue.js (2+) directive that clamps the content of an element by adding an ellipsis to it if the content inside is too long.

It uses @clampy-js/clampy library (a fork of Clamp.js) behind the scene to apply the ellipsis.

It automatically re-clamps itself when the element or the browser window change size.

Installation

You can install @clampy-js/vue-clampy using NPM or Yarn:

npm install @clampy-js/vue-clampy
yarn install @clampy-js/vue-clampy
Usage
<script>
import clampy from '@clampy-js/vue-clampy';
import Vue from 'vue';

Vue.use(clampy);

export default {
  name: 'app',
  directives: {
    clampy
  }
};
</script>
<template>
  <p v-clampy="3">Long text to clamp here</p>
</template>  
Options

You can also override default options globally:


Vue.use(clampy, {
  truncationChar: '✂️'
});
 

Related Packages

vue-ellipsis-3

一个高性能、可自定义的 vue3 文本缩略组件。

48,433 15
vue-clamp

Clamping primitives for Vue.

831,413 842
vue-text-middle-ellipsis

Simple vue-directive for the text middle ellipsis.

1,560 9
@boyuai/vue-clamp

Clamping multiline contents with ease.

1,449 8

Version History

Version Released License
1.0.6 MIT
1.0.5 MIT
1.0.4 MIT
1.0.3 MIT
1.0.2 MIT