diff --git a/package/component/src/component/upload/index.vue b/package/component/src/component/upload/index.vue index a7a6aec5..b9d4fef9 100644 --- a/package/component/src/component/upload/index.vue +++ b/package/component/src/component/upload/index.vue @@ -72,7 +72,7 @@ export interface UploadProps { text?: string; dragText?: string; modelValue?: any; - withForm?: boolean; + auto?: boolean; } const getCutDownResult = () => { @@ -86,7 +86,7 @@ const getCutDownResult = () => { Object.assign({ currentTimeStamp, cutResult: imgData, orginal: orgInfo }) ); let newFile = dataURLtoFile(imgData); - if (isInFormItem.value && props.withForm) { + if (!props.auto) { emit("update:modelValue", [newFile]); clearLightCutEffect(); return; @@ -164,7 +164,7 @@ const props = withDefaults(defineProps(), { cut: false, cutOptions: void 0, modelValue: null, - withForm: false, + auto: true, }); const slot = useSlots(); @@ -180,10 +180,6 @@ const emit = defineEmits([ "update:modelValue", ]); -const isInFormItem = computed( - () => context?.parent?.type.name === "LayFormItem" -); - watch( () => props.modelValue, () => { @@ -379,7 +375,7 @@ const uploadChange = (e: any) => { if (arm2) { console.warn(cannotSupportCutMsg.value); } - if (isInFormItem.value && props.withForm) { + if (!props.auto) { emit("update:modelValue", _files); return; } diff --git a/package/document-component/src/document/zh-CN/components/form.md b/package/document-component/src/document/zh-CN/components/form.md index 40e1bb0f..637b56bd 100644 --- a/package/document-component/src/document/zh-CN/components/form.md +++ b/package/document-component/src/document/zh-CN/components/form.md @@ -174,7 +174,7 @@ export default { - + 提交 diff --git a/package/document-component/src/document/zh-CN/components/upload.md b/package/document-component/src/document/zh-CN/components/upload.md index 0e707629..dc4f1b76 100644 --- a/package/document-component/src/document/zh-CN/components/upload.md +++ b/package/document-component/src/document/zh-CN/components/upload.md @@ -262,7 +262,7 @@ export default { | cutOptions | 开启剪裁的模态弹窗与剪裁框的配置 | object | { layerOption,copperOption } | -- | | text | 普通上传描述 | string | -- | -- | | dragText | 拖拽上传描述 | string | -- | -- | -| withForm | 是否跟随表单提交 | boolean | false | -- | +| auto | 是否自动提交 | boolean | false | -- | :::