fixed: Fixed NaN issue when setting timing interval

This commit is contained in:
zhaojisen
2024-09-17 13:34:51 +08:00
parent 4221bdb2ab
commit 49ea7d0969
2 changed files with 12 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
<template>
<el-input v-bind="$attrs" v-on="$listeners">
<el-input v-model="iValue" v-bind="$attrs" v-on="$listeners">
<template slot="append">{{ iUnit }}</template>
</el-input>
</template>
@@ -15,6 +15,7 @@ export default {
},
data() {
return {
defaultValue: 24,
displayMapper: {
'second': this.$t('Second'), // 'sec' is the default value of 'unit
'min': this.$t('Minute'), // 'min' is the default value of 'unit
@@ -29,6 +30,9 @@ export default {
computed: {
iUnit() {
return this.displayMapper[this.unit] || this.unit
},
iValue() {
return this.$attrs.value ? this.$attrs.value : this.defaultValue
}
}
}

View File

@@ -73,7 +73,13 @@ export default {
btn.loading = true
}
})
form.value.interval = parseInt(form.value.interval, 10)
if (form.value.interval && typeof form.value.interval === 'number') {
form.value.interval = parseInt(form.value.interval, 10)
} else {
form.value.interval = 24
}
this.$refs.form.$refs.form.dataForm.submitForm('form', false)
},
handleSubmitSuccess(res) {