fix(接口测试): 修复接口文档分享时间默认为空

This commit is contained in:
xinxin.wu 2024-10-21 18:40:41 +08:00 committed by Craftsman
parent a695d84a62
commit 02716aa690
2 changed files with 13 additions and 6 deletions

View File

@ -31,7 +31,11 @@
const { t } = useI18n();
const props = defineProps<{ defaultValue?: string; disabled?: boolean }>();
const props = defineProps<{
defaultValue?: string;
disabled?: boolean;
allowEmpty?: boolean; //
}>();
const emit = defineEmits<{
(e: 'change', value: string): void;
}>();
@ -43,7 +47,7 @@
function parseValue(v?: string) {
// 使
if (!v) {
return { type: 'H', value: 0 };
return { type: 'H', value: props.allowEmpty ? '' : 0 };
}
const match = v.match(/^(\d+(\.\d+)?)([MYHD])$/);
if (match) {
@ -52,9 +56,9 @@
return { type, value };
}
//
return { type: 'H', value: 0 };
return { type: 'H', value: props.allowEmpty ? '' : 0 };
}
const numberValue = ref(0);
const numberValue = ref();
const typeValue = ref('H');
function initNumberAndType() {
@ -103,7 +107,10 @@
watch(
() => modelValue.value,
() => {
initNumberAndType();
if (!props.allowEmpty) {
numberValue.value = 0;
initNumberAndType();
}
},
{
immediate: true,

View File

@ -59,7 +59,7 @@
</div>
</a-form-item>
<a-form-item field="effectiveTime" :label="t('apiTestManagement.effectiveTime')" asterisk-position="end">
<MsTimeSelectorVue v-model="invalidTimeValue" @change="handleTimeChange" />
<MsTimeSelectorVue v-model="invalidTimeValue" allow-empty @change="handleTimeChange" />
</a-form-item>
<div class="mb-[16px] flex items-center">
<a-switch v-model:model-value="form.isPrivate" class="mr-[8px]" size="small" @change="changePrivate" />