# @wu-component/wu-progress

> > TODO: description

Latest version **2.0.3** (published 2023-12-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install @wu-component/wu-progress
pnpm add @wu-component/wu-progress
yarn add @wu-component/wu-progress
bun add @wu-component/wu-progress
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2023-12-11 |
| First published | 2022-08-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 10 |
| Dependencies | 2 |
| Unpacked size | 65.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 216 |
| Author | Marvin |
| Maintainers | canyuegongzi |

## Links

- npm: https://www.npmjs.com/package/@wu-component/wu-progress
- Repository: https://github.com/wu-component/web-component-plus
- Homepage: https://github.com/wu-component/web-component-plus#readme
- Issues: https://github.com/wu-component/web-component-plus/issues
- npm.io page: https://npm.io/package/@wu-component/wu-progress

## Dependencies (2)

- [@wu-component/common](https://npm.io/package/@wu-component/common.md) latest
- [@wu-component/web-core-plus](https://npm.io/package/@wu-component/web-core-plus.md) latest

## Recent versions

- 2.0.3 (latest) — 2023-12-11
- 2.0.0 (next) — 2023-02-26
- 2.0.1 — 2023-02-26
- 1.11.8 — 2023-02-16
- 1.11.6 — 2023-02-15
- 1.11.4 — 2023-02-14
- 1.10.6 — 2023-02-13
- 1.10.1 — 2023-02-13
- 1.9.24 — 2022-11-13
- 1.9.21 — 2022-11-12
- 1.9.20 — 2022-11-12
- 1.9.17 — 2022-11-12
- 1.9.1 — 2022-11-05
- 1.8.0 — 2022-10-27
- 1.7.0 — 2022-10-22
- … 16 more at https://npm.io/package/@wu-component/wu-progress/versions

## README

## Progress 进度条

用于展示操作进度，告知用户当前状态和预期。

### 基础用法

Progress 组件设置percentage属性即可，表示进度条对应的百分比，必填，必须在 0-100。

::: demo
```html
<template>
    <div style="display: flex; align-items: center; flex-direction: column; padding: 16px">
        <wu-plus-progress style="width: 350px" percentage="70"></wu-plus-progress>
        <span style="height: 16px"></span>
        <wu-plus-progress style="width: 350px" percentage="60" color="red"></wu-plus-progress>
        <span style="height: 16px"></span>
        <wu-plus-progress style="width: 350px" percentage="50" color="yellow"></wu-plus-progress>
    </div>
</template>
<script>
</script>
```
:::

### 百分比内显

百分比不占用额外控件，适用于文件上传等场景。

::: demo
```html
<template>
    <div style="display: flex; align-items: center;flex-direction: column;padding: 16px">
        <wu-plus-progress style="width: 350px" text-inside="true" stroke-width="26" percentage="70" color="#409eff"></wu-plus-progress>
        <span style="height: 16px"></span>
        <wu-plus-progress style="width: 350px" text-inside="true" stroke-width="26" percentage="60" color="green"></wu-plus-progress>
        <span style="height: 16px"></span>
        <wu-plus-progress style="width: 350px" text-inside="true" stroke-width="26" percentage="50" color="red"></wu-plus-progress>
        <span style="height: 16px"></span>
        <wu-plus-progress style="width: 350px" text-inside="true" stroke-width="26" percentage="50" color="#e6a23c"></wu-plus-progress>
    </div>
</template>
<script>
</script>
```
:::

### 自定义颜色、粗细

可以通过 color 设置进度条的颜色，通过 stroke-width 定义粗细。

::: demo
```html
<template>
    <div style="display: flex; align-items: center;flex-direction: column;padding: 16px">
        <wu-plus-progress style="width: 350px" show-text="false" text-inside="false" stroke-width="26" percentage="70" color="#409eff"></wu-plus-progress>
        <span style="height: 8px"></span>
        <wu-plus-progress style="width: 350px" show-text="false" text-inside="false" stroke-width="20" percentage="60" color="green"></wu-plus-progress>
        <span style="height: 8px"></span>
        <wu-plus-progress style="width: 350px" show-text="false" text-inside="false" stroke-width="16" percentage="50" color="red"></wu-plus-progress>
        <span style="height: 8px"></span>
        <wu-plus-progress style="width: 350px" show-text="false" text-inside="false" stroke-width="10" percentage="50" color="#e6a23c"></wu-plus-progress>
    </div>
</template>
<script>
</script>
```
:::

### 环形进度条

Progress 组件可通过 type 属性来指定使用环形进度条，在环形进度条中，还可以通过 width 属性来设置其大小。

::: demo
```html
<template>
    <div style="display: flex; width: 80%; margin: 0 auto; align-items: center;justify-content: space-around;padding: 16px">
        <wu-plus-progress type="circle" id="progressCircleId1" percentage="0"></wu-plus-progress>
        <span style="height: 8px"></span>
        <wu-plus-progress type="circle"  text-inside="true" stroke-width="6" percentage="60" color="green"></wu-plus-progress>
        <span style="height: 8px"></span>
        <wu-plus-progress style="width: 350px" type="dashboard" id="progressCircleId19" percentage="25"></wu-plus-progress>
    </div>
</template>
<script>
</script>
```
:::

### 仪表盘形进度条

::: demo
```html
<template>
    <div style="display: flex; width: 400px; margin:0 auto; align-items: center;justify-content: space-around;padding: 16px">
        <wu-plus-progress style="width: 350px" type="circle" id="progressCircleId10" percentage="25"></wu-plus-progress>
        <span style="height:8px"></span>
        <div style="display: flex;flex-direction: row;">
            <wu-plus-button size="mini" type="primary" id="progressButton1">+</wu-plus-button>
            <wu-plus-button size="mini" type="success" id="progressButton2" style="margin-left: 16px;">-</wu-plus-button>
        </div>
    </div>
</template>
<script>
    let num = 25
    export default {
        mounted() {
            const progressButton1 = document.getElementById("progressButton1");
            const progressButton2 = document.getElementById("progressButton2");
            const progressCircleId1 = document.getElementById("progressCircleId10");
            progressButton1.addEventListener("click", () => {
                num = num + 5
                if (num >= 100) {
                    num = 100
                }
                progressCircleId1.setAttribute("percentage", num)
            })

            progressButton2.addEventListener("click", () => {
                num = num - 5
                if (num <= 0) {
                    num = 0
                }
                progressCircleId1.setAttribute("percentage", num)
            })
        }
    }
</script>
```
:::

### Attributes

| 参数      | 说明    | 类型      | 可选值       | 默认值   |
|---------- |-------- |---------- |-------------  |-------- |
| percentage  | 百分比（必填 0 —— 100 ） | number | 0-100  | 0 |
| type | 进度条类型 | TypeEnums | "line" 、 "circle" 、 "dashboard" | "line" |
| stroke-width	 | 进度条的宽度，单位 px | number | -- | 6 |
| text-inside	 | 进度条显示文字内置在进度条内（只在 type=line 时可用） | boolean | true、false | false |
| color	 | 进度条背景色 | String | -- | -- |
| width	 | 环形进度条画布宽度（只在 type 为 circle 或 dashboard 时可用） | Number | -- | 126 |
| show-text	 | 是否显示进度条文字内容 | Boolean | true、false | true |
| stroke-linecap	 | circle/dashboard 类型路径两端的形状 | StrokeLinecapEnums |  "butt"、 "round"、"square" | "round" |

---
_Source: https://npm.io/package/@wu-component/wu-progress · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
