1. Progress进度条

1.1. Progress进度条, 用于展示操作进度, 告知用户当前状态和预期。

1.2. Attributes

参数

说明

类型

可选值

默认值

percentage

百分比(必填)

number

0-100

0

type

进度条类型

string

line/circle/dashboard

line

stroke-width

进度条的宽度, 单位px

number

6

text-inside

进度条显示文字内置在进度条内(只在type=line时可用)

boolean

false

status

进度条当前状态

string

success/exception/warning

color

进度条背景色(会覆盖status状态颜色)

string/function/array

''

width

环形进度条画布宽度(只在type为circle或dashboard时可用)

number

126

show-text

是否显示进度条文字内容

boolean

true

stroke-linecap

circle/dashboard类型路径两端的形状

string

butt/round/square

round

format

指定进度条文字内容

function(percentage)

2. Progress进度条例子

2.1. 使用脚手架新建一个名为element-ui-progress的前端项目, 同时安装Element插件。

2.2. 编写index.js

import Vue from 'vue'
import VueRouter from 'vue-router'
import Progress from '../components/Progress.vue'
import ColorProgress from '../components/ColorProgress.vue'
import DashboardProgress from '../components/DashboardProgress.vue'Vue.use(VueRouter)const routes = [{ path: '/', redirect: '/Progress' },{ path: '/Progress', component: Progress },{ path: '/ColorProgress', component: ColorProgress },{ path: '/DashboardProgress', component: DashboardProgress }
]const router = new VueRouter({routes
})export default router

2.3. 在components在新建Progress.vue

<template><div><h1>线形进度条</h1><h4>Progress组件设置percentage属性即可, 表示进度条对应的百分比, 必填, 必须在0-100。通过format属性来指定进度条文字内容。</h4><el-progress :percentage="50"></el-progress><el-progress :percentage="100" :format="format"></el-progress><el-progress :percentage="100" status="success"></el-progress><el-progress :percentage="100" status="warning"></el-progress><el-progress :percentage="50" status="exception"></el-progress><h1>百分比内显-百分比不占用额外控件, 适用于文件上传等场景</h1><h4>Progress组件可通过stroke-width属性更改进度条的高度, 并可通过text-inside属性来将进度条描述置于进度条内部。</h4><el-progress :text-inside="true" :stroke-width="26" :percentage="70"></el-progress><el-progress :text-inside="true" :stroke-width="24" :percentage="100" status="success"></el-progress><el-progress :text-inside="true" :stroke-width="22" :percentage="80" status="warning"></el-progress><el-progress :text-inside="true" :stroke-width="20" :percentage="50" status="exception"></el-progress><h1>环形进度条</h1><h4>Progress组件可通过type属性来指定使用环形进度条, 在环形进度条中, 还可以通过width属性来设置其大小。</h4><el-progress type="circle" :percentage="0"></el-progress><el-progress type="circle" :percentage="25"></el-progress><el-progress type="circle" :percentage="100" status="success"></el-progress><el-progress type="circle" :percentage="70" status="warning"></el-progress><el-progress type="circle" :percentage="50" status="exception"></el-progress></div>
</template><script>
export default {methods: {format (percentage) {return percentage === 100 ? '满' : `${percentage}%`}}
}
</script><style scoped>
.el-progress + .el-progress {margin-top: 20px;
}
.el-progress--circle + .el-progress--circle {margin-left: 20px;
}
</style>

2.4. 在components在新建ColorProgress.vue

<template><div><h1>自定义颜色</h1><h4>可以通过color设置进度条的颜色, color可以接受颜色字符串, 函数和数组。</h4><el-progress :percentage="percentage" :color="customColor"></el-progress><el-progress :percentage="percentage" :color="customColorMethod"></el-progress><el-progress :percentage="percentage" :color="customColors"></el-progress><div><el-button-group><el-button icon="el-icon-minus" @click="decrease"></el-button><el-button icon="el-icon-plus" @click="increase"></el-button></el-button-group></div></div>
</template><script>
export default {data () {return {percentage: 20,customColor: '#409eff',customColors: [{ color: '#f56c6c', percentage: 20 },{ color: '#e6a23c', percentage: 40 },{ color: '#5cb87a', percentage: 60 },{ color: '#1989fa', percentage: 80 },{ color: '#6f7ad3', percentage: 100 }]}},methods: {customColorMethod (percentage) {if (percentage < 30) {return '#909399'} else if (percentage < 70) {return '#e6a23c'} else {return '#67c23a'}},increase () {this.percentage += 10if (this.percentage > 100) {this.percentage = 100}},decrease () {this.percentage -= 10if (this.percentage < 0) {this.percentage = 0}}}
}
</script><style scoped>
.el-progress + .el-progress {margin-top: 20px;
}
</style>

2.5. 在components在新建DashboardProgress.vue

<template><div><h1>仪表盘形进度条</h1><h4>通过type属性来指定使用仪表盘形进度条。</h4><el-progress type="dashboard" :percentage="percentage" :color="colors"></el-progress><div><el-button-group><el-button icon="el-icon-minus" @click="decrease"></el-button><el-button icon="el-icon-plus" @click="increase"></el-button></el-button-group></div></div>
</template><script>
export default {data () {return {percentage: 10,colors: [{ color: '#f56c6c', percentage: 20 },{ color: '#e6a23c', percentage: 40 },{ color: '#5cb87a', percentage: 60 },{ color: '#1989fa', percentage: 80 },{ color: '#6f7ad3', percentage: 100 }]}},methods: {increase () {this.percentage += 10if (this.percentage > 100) {this.percentage = 100}},decrease () {this.percentage -= 10if (this.percentage < 0) {this.percentage = 0}}}
}
</script>

2.6. 访问http://localhost:8080/#/Progress

2.7. 访问http://localhost:8080/#/ColorProgress

2.8. 访问http://localhost:8080/#/DashboardProgress

024_Progress进度条相关推荐

  1. web app升级—带进度条的App自动更新

    带进度条的App自动更新,效果如下图所示:   技术:vue.vant-ui.5+ 封装独立组件AppProgress.vue: <template><div><van- ...

  2. 一个KVO 实现WKWebView加载进度条的例子 (注意最后移除观察者)

    // // OpenWebViewController.m // Treasure // // Created by 蓝蓝色信子 on 16/7/29. // Copyright © 2016年 GY ...

  3. html资源文件记载进度条,用进度条显示文件读取进度《 HTML5:文件 API 》

    在这个文档里,我添加了一个 标签 .. 上面定义了一个 ID 是 eventstatus - 我们可以把进度条放在这个容器里面 - 先找到用来显示进度条的容器 - // 找到显示事件状态的容器 var ...

  4. android炫酷的自定义view,Android自定义View实现炫酷进度条

    本文实例为大家分享了Android实现炫酷进度条的具体代码,供大家参考,具体内容如下 下面我们来实现如下效果: 第一步:创建attrs文件夹,自定义属性: 第二步:自定义View: /** * Cre ...

  5. python特效进度条_六种酷炫Python运行进度条

    作者 | 行哥 来源 | 一行数据 之前行哥给大家推荐过一个windows神器,里面有个小功能是人生进度条,可以看到2020年的进度只剩下一半,那么你的代码进度还剩多少呢? 这不,行哥本文介绍了目前6 ...

  6. html 可调节进度条控件,jQuery简单实用的轻量级进度条插件

    jQMeter是一款简单实用的轻量级进度条jQuery插件,它可以显示为水平或垂直进度条,进度条加载时带有动画特效,你只需要简单的传入一些参数到jQMeter对象的构造函数中就可以完成你想要的进度条效 ...

  7. 6行Python代码实现进度条效果(Progress、tqdm、alive-progress​​​​​​​和PySimpleGUI库)

    目录 1.Progress库 2.tqdm库 3.alive-progress库 4.PySimpleGUI库 在项目开发过程中加载.启动.下载项目难免会用到进度条,如何使用Python实现进度条呢? ...

  8. perl 如何更新_Perl 进度条模块

    Term::ProgressBar 模块是一个可以用于生成进度条的 Perl 模块. 安装:cpan -i Term::ProgressBar 最小脚本,展示如何最快学会使用该模块: #!/usr/b ...

  9. python 视频播放 拖动_视频画中画效果,拖动进度条可以seek到相应视频帧显示

    在视频开发中,我们常常看到这样的效果,拖动进度条时,或是在进度条上方或是在屏幕中间,显示拖动进度条位置时刻的某一帧画面. 这个需求,如果是你,你会如何做? 通常一个需求,不仅要考虑实现,还有考虑一些是 ...

最新文章

  1. Linux 查看并删除.svn目录
  2. 你知道i=i++;的含义吗?原理其实没有你想的那么简单
  3. artTemplate/template.js模板将时间戳格式化为正常的日期
  4. 对于linux socket与epoll配合相关的一些心得记录
  5. QT中border-image的解释
  6. List和Set集合使用
  7. 【转】【MySql】Waiting for table metadata lock原因分析
  8. Resharper插件如何启用原VS的智能提示
  9. Python Profiler 列举
  10. pillow python histogram_Python中的PIL库
  11. 安装qt qmake 错误:could not find a Qt installation of ''
  12. Xcode dSYM 文件
  13. Spring5学习笔记——【遇见狂神说】[IoC、DI、AOP]
  14. UBUNTU 编译安装GEOS
  15. R语言IBM股票月对数收益率的Egarch模型
  16. 计算机骂人的专业术语,台湾网友分享“如何用本专业术语骂人不带脏字”
  17. 计算机长时间休眠后无法唤醒,win7电脑休眠后无法唤醒解决方法
  18. c++11后面引入的新特性(三)
  19. 在电脑屏幕上截图的5种方式
  20. java lambda 反射_反射调用与Lambda表达式调用

热门文章

  1. 裂痕第一至五季/以法之名Damages迅雷下载
  2. 数据处理的两个基本问题05 - 零基础入门学习汇编语言42
  3. MPLS BGP标签分发过程——Vecloud
  4. Eclipse编译时保留方法的形参
  5. Insert SQL Query插入效率优化
  6. 1-编程的基本条件和起步
  7. ES6之路第十二篇:Promise对象
  8. 教你如何成为数据科学家(六)
  9. 删除弹出提示框_MVC
  10. Nginx TCP代理