调整 withForm 属性为 auto 属性

This commit is contained in:
就眠儀式
2022-11-13 23:30:57 +08:00
parent 0692717841
commit ef01d2baa9
3 changed files with 6 additions and 10 deletions

View File

@@ -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<UploadProps>(), {
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;
}