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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vue-auto-text

v1.0.4

Published

[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg)](https://opensource.org/licenses/mit-license.php) [![npm](https://img.shields.io/npm/v/vue-auto-text.svg)](https://www.npmjs.com/package/vue-auto-text) [![size](https://img.shields.io/bundlephobi

Downloads

104

Readme

vue-auto-text | 文字大小自适应组件

MIT Licence npm size download

介绍

当给定宽度时, 文字的大小自适应, 以保证不溢出和换行

演示图

文档

https://dream2023.github.io/vue-auto-text

安装

npm install vue-auto-text --save

使用

// 局部引入
import AutoText from 'vue-auto-text'
export default {
  components: {
    AutoText
  }
}
// 全局引入
import AutoText from 'vue-auto-text'
Vue.component(AutoText.name, AutoText)

Props 参数

props: {
  // 文本限定宽度, 单位px, 可选, 如果不传, 则默认是父元素宽度
  width: Number,
  // 给定文本, 可选, 如果不传, 则获取插槽内文本, 但无法检测变化
  text: String,
  // 默认 font-size 大小, 数字, 必填
  size: {
    type: Number,
    required: true
  },
  // 最小 font-size 大小, 默认是 16 px
  minSize: {
    type: Number,
    default: 16
  },
  // 当文本超出时处理方式, ellipsis 超出省略号, clip 超出截断, break 超出换行
  overflow: {
    type: String,
    default: 'ellipsis',
    validator (value) {
      return value === 'ellipsis' || value === 'clip' || value === 'break'
    }
  }
}

例子

<!-- 可以检查到字数变化, 进而动态更改字体大小 -->
<auto-text :minSize="24" :size="48" :text="text" :width="200" />
<!-- 仅能根据首次获取字数多少, 进行判断字体大小, 无法检测到字数变化 -->
<auto-text :minSize="24" :size="48" :width="200">{{text}}</auto-text>
<!-- 超出换行 -->
<auto-text
  :minSize="24"
  overflow="break"
  :size="48"
  :text="text"
  :width="200"
/>