使用 element-ui 的 el-progress 写的进度条
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
相信你会用得到,动态创建弹框,看了不后悔,给自己另外一篇文章引流
<template>
<div class="scaleProgress">
<el-progress :text-inside="true" :stroke-width="18" :percentage="progressNum"></el-progress>
</div>
</template>
<script>
export default {
data() {
return {
progressNum: 10,
startTimer: '',
endTimer: ''
}
},
props: {
progressStatus: {
type: Boolean,
default() {
return false
}
}
},
watch: {
progressStatus (val) {
if (val) {
this.endProgress()
}
}
},
methods: {
startProgress () {
this.startTimer = setInterval(() => {
this.progressNum ++
if (this.progressNum > 85) {
clearInterval(this.startTimer)
}
}, 100);
},
endProgress () {
clearInterval(this.startTimer)
this.endTimer = setInterval(() => {
this.progressNum ++
if (this.progressNum > 99) {
clearInterval(this.endTimer)
this.finishProgress()
}
}, 10);
},
finishProgress () {
this.$emit('finishProgress', false)
}
},
mounted() {
this.startProgress()
}
}
// 使用示例
// import sProgress from 'components/common/SProgress'
// <s-progress @finishProgress="closeProgress" v-if="showProgress" :progressStatus="progressStatus"></s-progress>
// closeProgress (val) {
// this.showProgress = val
// this.progressStatus = val
// },
// save () {
// this.showProgress = true
// setTimeout(() => {
// this.progressStatus = true
// }, 3000)
// },
</script>
<style scoped>
.scaleProgress {
transform: scaleY(0.75);
}
</style>
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45
7 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 7 个月前
更多推荐
已为社区贡献2条内容
所有评论(0)