需求是,当进度条的percentage到100%时,status变为"success"
所以我的写法是如下
//标签部分
<el-progress type="circle" :percentage="percentage" :status="progressStatus"></el-progress>
//js部分
export default {
name: "test",
data() {
return {
percentage:90,
progressStatus:""
}
},
methods:
percentage(){
const _flag = setInterval(() => {
//从90自增到100
this.percentage++
if(this.percentage==100){
//自增到100后把进度条status变为success
clearInterval(_flag)
this.progressStatus = 'success'
}
}, 200);
}
}
但是会报错:[Vue warn]: Invalid prop: custom validator check failed for prop "status".
会报错9次,也就是说前九次因为没给<el-progress>中的status赋值,所以报错,第十次给它赋值了(success),所以不报错了。
问题是官方只给了"success" "warning" "exception"这三个特殊情况的值,没给正常情况下的默认值,又不能让默认值为空,我该怎么办