npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-ellipsis-3

v0.0.8

Published

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

Downloads

4,534

Readme

vue-ellipsis-3

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

Vue 2.x 版本:vue-ellipsis-component

React 版本:react-ellipsis

Demo

demo.gif

安装

推荐使用 npm 或是 yarn 进行组件安装:

# npm
npm i vue-ellipsis-3
# or yarn
yarn add vue-ellipsis-3

注册组件

全局注册

import VueEllipsis3 from 'vue-ellipsis-3';

app.use(VueEllipsis3);

在组件中注册

<script>
import { VueEllipsis3 } from 'vue-ellipsis-3';

export default {
  components: {
    VueEllipsis3,
  },
};
</script>

使用

<template>
  <vue-ellipsis-3 text="这是一段非常非常非常非常非常非常非常非常非常非常非常长的话" />
</template>

vue-ellipsis-3 只是在 vue-ellipsis-component 上做迁移,更多示例可以完全参考 vue-ellipsis-component

属性

| 属性名 | 类型 | 默认值 | 描述 | | --------------- | ----------------------------------------- | -------- | ------------------------------------------------------------ | | text | string | Required | 需要进行缩略的文本 | | visibleLine | number | 1 | 文本可见行数;超过该行数时文本会进行裁剪。visibleLine 不可大于 maxLine | | visibleHeight | number | | 文本可见高度;超过该高度时文本会进行裁剪,优先级高于 visibleLinevisibleHeight 不可大于 maxHeight | | ellipsis | boolean | true | 是否开启缩略 | | ellipsisNode | string | ... | 自定义缩略符 | | endExcludes | (string | RegExp)[] | [] | 结尾处希望被过滤掉的字符(在缩略符之前),支持字符串和正则表达式 | | useInnerHtml | boolean | false | 将 text 当做 HTML 进行缩略(请确保传递的 text 安全可靠,否则可能导致 XSS 安全问题) | | maxLine | number | | 和 visibleLine 配合使用,当行数超过 maxLine 时缩略成 visibleLine 行,具体查看:超过 n 行时展示 m 行 | | maxHeight | number | | 和 visibleHeight 配合使用,当文本高度超过 maxHeight 时缩略成 visibleHeight,具体查看:超过高度 n 时,展示高度 m | | reflowOnResize | boolean | | 容器大小改变时是否重新布局,原生缩略支持时默认是 true,否则为 false | | onReflow | (ellipsis: boolean, text: string) => void | | 重排完成回调事件。参数 ellipsis 表示文本是否被截断;参数 text 为可见文本(不包含缩略符) | | onEllipsisClick | () => void | | 缩略符点击回调事件 |

插槽

| 名称 | 描述 | | ------------ | ------------------------------------------------------------ | | ellipsisNode | 自定义缩略符,优先级高于 ellipsisNode 属性,若是同时设置,则以 slot 为准 |

License

MIT

Develop & Contribution

# install deps of component
yarn
# start the frontend server
yarn dev
# run unit test
yarn test

If you want to contribute your code, send a pull request in github.