change(Crontab): 还原原版,不作修改

- 移除了对 this.$options.propsData.check 的冗余判断
- 直接使用 this.$options.propsData.check 初始化 checkNum
- 删除了 created 钩子中对 check 函数的冗余赋值
- 简化了 cycleTotal 和 averageTotal 计算属性中的条件判断
master
zch 5 days ago
parent 48b160914e
commit 25ecf90265

@ -43,7 +43,7 @@ export default {
average01: 0,
average02: 1,
checkboxList: [],
checkNum: this.$options && this.$options.propsData && this.$options.propsData.check ? this.$options.propsData.check : (val) => val
checkNum: this.$options.propsData.check
}
},
name: 'crontab-second',
@ -97,14 +97,14 @@ export default {
computed: {
//
cycleTotal: function () {
const cycle01 = typeof this.checkNum === 'function' ? this.checkNum(this.cycle01, 0, 58) : this.cycle01
const cycle02 = typeof this.checkNum === 'function' ? this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59) : this.cycle02
const cycle01 = this.checkNum(this.cycle01, 0, 58)
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
return cycle01 + '-' + cycle02;
},
//
averageTotal: function () {
const average01 = typeof this.checkNum === 'function' ? this.checkNum(this.average01, 0, 58) : this.average01
const average02 = typeof this.checkNum === 'function' ? this.checkNum(this.average02, 1, 59 - average01 || 0) : this.average02
const average01 = this.checkNum(this.average01, 0, 58)
const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
return average01 + '/' + average02;
},
// checkbox
@ -112,12 +112,6 @@ export default {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
}
},
created() {
// propscheck使propscheck
if (typeof this.check === 'function') {
this.checkNum = this.check;
}
}
}
</script>

Loading…
Cancel
Save