瀏覽代碼

Add clear form progress

pull/342/head
Guillaume Vincent 6 年之前
父節點
當前提交
8ba6123160
共有 1 個文件被更改,包括 34 次插入0 次删除
  1. +34
    -0
      src/components/ClearFormProgress.vue

+ 34
- 0
src/components/ClearFormProgress.vue 查看文件

@@ -0,0 +1,34 @@
<template>
<div class="progress" style="height: 1px;">
<div class="progress-bar" role="progressbar" v-bind:style="{ width: width + '%' }" v-bind:aria-valuenow="width" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</template>
<script>
export default {
name: "clearProgress",
props: {
duration: {
type: Number,
default: 30
}
},
data() {
return {
width: 100,
clearInterval: null
};
},
mounted() {
this.clearInterval = setInterval(() => {
this.width = this.width - 1;
}, this.duration * 10);
},
watch: {
width: function(value) {
if (value <= 0) {
clearInterval(this.clearInterval);
}
}
}
};
</script>

Loading…
取消
儲存