效果:
<a-form-item label="Cron表达式" name="cron" required>
<a-input v-show="false" v-model:value="setForm.cron"></a-input>
<a-button type="primary" size="small" @click="handleCronconfig"> 配置 </a-button>
</a-form-item>
function handleCronconfig () {
modalvisible.value=true
}
<a-modal v-model:visible="modalvisible" title="Cron表达式" @cancel="handlecancel" :destroyOnClose="true" @ok="handleOk">
<vue3-cron v-model="expression" locale="cn"/>
</a-modal>
import Vue3Cron from 'vue3-cron-antd';
function handleOk () {
modalvisible.value = false
getval(expression.value)
formref.value.validateFields('cron')
}
function handlecancel () {
modalvisible.value = false
}
function getval (param) {
setForm.value.cron = param
}
const expression=ref('* * * * * ?')