1.1.6 • Published 5 years ago

@hyjiacan/vue-ellipsis v1.1.6

Weekly downloads
56
License
MIT
Repository
github
Last release
5 years ago

vue-ellipsis

Customize ellipsis-like support for Vue2.

Samples: https://hyjiacan.github.io/vue-ellipsis/

Install

yarn add @hyjiacan/vue-ellipsis

or

npm install @hyjiacan/vue-ellipsis

Usage

import ellipsis from '@hyjiacan/vue-ellipsis'
Vue.use(ellipsis)

or

import {ellipsisDirective, ellipsisComponent} from '@hyjiacan/vue-ellipsis'
// For directive usage
Vue.directive(ellipsisDirective.name, ellipsisDirective)
// For component usage
Vue.component(ellipsisComponent.name, ellipsisComponent)

// Use one of above makes it works.

You should specify the width via CSS.

.ellipsis-style{
    width: 200px;
}
.ellipsis-style{
    width: 80%;
}
.ellipsis-style{
    max-width: 200px;
}

or STYLE

<div style="width: 200px"></div>
<ellipsis style="width: 80%"></ellipsis>
<ellipsis style="width: 200px"></ellipsis>

Directive

  • The value of directive v-ellipsis is the rows, default value: 1 , set 0 to show all text.

Modifiers

namedescription
startShow ellipsis as prefix
middleShow ellipsis in the middle
endShow ellipsis as suffix
alwaysALWAYS show title while text overflow
noneDO NOT show title while text overflow
scaleAuto scale (font-size) text to fit container width, WON'T ellipsis
  • Modifiers start, middle, end are mutex, you should specify only one of them (default: end).
  • Modifiers always, none are mutex, you should specify only one of them, or leave it empty(Set title when there is an ellipsis, just like auto for property showTitle).

Attributes

namedefaultdescription
data-ellipsis...Default fill text (ellipsis like text)
data-delay200the delay(milliseconds) for making ellipsis

Component

Props

nametypedefaultdescription
fillString...Default fill text (ellipsis like text)
positionStringendEllipsis position, options: start, middle, end
show-titleString-options: always, none, auto(default)
rowsNumber1Number of rows, set 0 to show all text
scaleBooleanfalseAuto scale (font-size) text to fit container width, DO NOT ellipsis
contentStringendThe content, makes the slot default ignored

Slots

namedescription
defaultThe content

FAQ

  1. Q: I have an element with padding by percentage, got unexpected display ? A: Padding by percentage is not supported for now.
1.1.6

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.4.3

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago