fix(sj_1.0.1): 修复 cron 表达式组件问题

This commit is contained in:
dhb52 2024-06-14 22:29:28 +08:00
parent 5bfb638cfc
commit 5f7b149519
2 changed files with 7 additions and 4 deletions

View File

@ -15,7 +15,7 @@ interface Props {
min: number;
max: number;
};
locale: I18n.LocaleType;
locale?: I18n.LocaleType;
}
const props = withDefaults(defineProps<Props>(), {
@ -106,7 +106,9 @@ const value = computed(() => {
return props.field.value === DATE ? type.value : `${lastDayOfWeek.value}${type.value}`;
case TYPE.SPECIFY: {
const specifyValue = specify.value;
return specifyValue.length ? specifyValue.sort((a, b) => a - b).join(type.value) : `${specifyValue[0] || 0}`;
return specifyValue.length
? specifyValue.sort((a, b) => a - b).join(type.value)
: `${specifyValue[0] || specifies.value[0].value}`;
}
default:
return '';
@ -144,7 +146,8 @@ watch(
specify.value =
data !== 'undefined' && data !== 'NaN' ? data.split(TYPE.SPECIFY).map(i => Number.parseInt(i, 10)) : [];
}
}
},
{ immediate: true }
);
watch(

View File

@ -81,7 +81,7 @@ const previews = computed(() => {
try {
previewList = parserCron(expression.value);
} catch (error) {
previewList = ['此表达式暂时无法解析!'];
previewList = [Locales[props.lang].previewError];
}
return previewList;