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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ophiuchus/circle

v1.0.1

Published

### 介绍

Downloads

2

Readme

Circle 环形进度条

介绍

圆环形的进度条组件,支持进度渐变动画。

引入

import Vue from 'vue';
import Circle from '@ophiuchus/circle';

Vue.use(Circle);

代码演示

基础用法

rate 属性表示进度条的目标进度,v-model 表示动画过程中的实时进度。当 rate 发生变化时,v-model 会以 speed 的速度变化,直至达到 rate 设定的值。

<sf-circle v-model="currentRate" :rate="30" :speed="100" :text="text" />
export default {
  data() {
    return {
      currentRate: 0,
    };
  },
  computed: {
    text() {
      return this.currentRate.toFixed(0) + '%';
    },
  },
};

宽度定制

通过 stroke-width 属性来控制进度条宽度。

<sf-circle
  v-model="currentRate"
  :rate="rate"
  :stroke-width="60"
  text="宽度定制"
/>

颜色定制

通过 color 属性来控制进度条颜色,layer-color 属性来控制轨道颜色。

<sf-circle
  v-model="currentRate"
  :rate="rate"
  layer-color="#ebedf0"
  text="颜色定制"
/>

渐变色

color 属性支持传入对象格式来定义渐变色。

<sf-circle
  v-model="currentRate"
  :rate="rate"
  :color="gradientColor"
  text="渐变色"
/>
export default {
  data() {
    return {
      currentRate: 0,
      gradientColor: {
        '0%': '#3fecff',
        '100%': '#6149f6',
      },
    };
  },
};

逆时针方向

clockwise 设置为 false,进度会从逆时针方向开始。

<sf-circle
  v-model="currentRate"
  :rate="rate"
  :clockwise="false"
  text="逆时针方向"
/>

大小定制

通过 size 属性设置圆环直径。

<sf-circle v-model="currentRate" :rate="rate" :clockwise="false" size="120px" text="大小定制" />

API

Props

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | v-model | 当前进度 | number | - | | rate | 目标进度 | number | string | 100 | | size | 圆环直径,默认单位为 px | number | string | 100px | | color | 进度条颜色,传入对象格式可以定义渐变色 | string | object | #1989fa | | layer-color | 轨道颜色 | string | white | | fill | 填充颜色 | string | none | | speed | 动画速度(单位为 rate/s) | number | string | 0 | | text | 文字 | string | - | | stroke-width | 进度条宽度 | number | string | 40 | | stroke-linecap | 进度条端点的形状,可选值为sqaure butt | string | round | | clockwise | 是否顺时针增加 | boolean | true |

Slots

| 名称 | 说明 | | ------- | -------------- | | default | 自定义文字内容 |

样式变量

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

| 名称 | 默认值 | 描述 | | ------------------------ | ------------------- | ---- | | @circle-size | 100px | - | | @circle-color | @blue | - | | @circle-layer-color | @white | - | | @circle-text-color | @text-color | - | | @circle-text-font-weight | @font-weight-bold | - | | @circle-text-font-size | @font-size-md | - | | @circle-text-line-height | @line-height-md | - |