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

@ophiuchus/progress

v1.0.1

Published

### 介绍

Readme

Progress 进度条

介绍

用于展示操作的当前进度。

引入

import Vue from 'vue';
import Progress from '@ophiuchus/progress';

Vue.use(Progress);

代码演示

基础用法

进度条默认为蓝色,使用 percentage 属性来设置当前进度。

<sf-progress :percentage="50" />

线条粗细

通过 stroke-width 可以设置进度条的粗细。

<sf-progress :percentage="50" stroke-width="8" />

置灰

设置 inactive 属性后进度条将置灰。

<sf-progress inactive :percentage="50" />

样式定制

可以使用 pivot-text 属性自定义文字,color 属性自定义进度条颜色。

<sf-progress pivot-text="橙色" color="#f2826a" :percentage="25" />
<sf-progress pivot-text="红色" color="#ee0a24" :percentage="50" />
<sf-progress
  :percentage="75"
  pivot-text="紫色"
  pivot-color="#7232dd"
  color="linear-gradient(to right, #be99ff, #7232dd)"
/>

API

Props

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | percentage | 进度百分比 | number | string | 0 | | stroke-width | 进度条粗细,默认单位为px | number | string | 4px | | color | 进度条颜色 | string | #1989fa | | track-color | 轨道颜色 | string | #e5e5e5 | | pivot-text | 进度文字内容 | string | 百分比 | | pivot-color | 进度文字背景色 | string | 同进度条颜色 | | text-color | 进度文字颜色 | string | white | | inactive | 是否置灰 | boolean | false | | show-pivot | 是否显示进度文字 | boolean | true |

方法

通过 ref 可以获取到 Progress 实例并调用实例方法,详见组件实例方法

| 方法名 | 说明 | 参数 | 返回值 | | ------ | -------------------------------------------- | ---- | ------ | | resize | 外层元素大小变化后,可以调用此方法来触发重绘 | - | - |

样式变量

组件提供了下列 Less 变量,可用于自定义样式,使用方法请参考主题定制

| 名称 | 默认值 | 描述 | | -------------------------------- | --------------- | ---- | | @progress-height | 4px | - | | @progress-color | @blue | - | | @progress-background-color | @gray-3 | - | | @progress-pivot-padding | 0 5px | - | | @progress-pivot-text-color | @white | - | | @progress-pivot-font-size | @font-size-xs | - | | @progress-pivot-line-height | 1.6 | - | | @progress-pivot-background-color | @blue | - |

常见问题

组件从隐藏状态切换到显示状态时,渲染不正确?

Progress 组件在挂载时,会获取自身的宽度,并计算出进度条的样式。如果组件一开始处于隐藏状态,则获取到的宽度永远为 0,因此无法展示正确的进度。

解决方法

方法一,如果是使用 v-show 来控制组件展示的,则替换为 v-if 即可解决此问题:

<!-- Before -->
<sf-progress v-show="show" />
<!-- After -->
<sf-progress v-if="show" />

方法二,调用组件的 resize 方法来主动触发重绘:

<sf-progress v-show="show" ref="progress" />
this.$refs.progress.resize();