调整 withForm 属性为 auto 属性
This commit is contained in:
parent
0692717841
commit
ef01d2baa9
@ -72,7 +72,7 @@ export interface UploadProps {
|
|||||||
text?: string;
|
text?: string;
|
||||||
dragText?: string;
|
dragText?: string;
|
||||||
modelValue?: any;
|
modelValue?: any;
|
||||||
withForm?: boolean;
|
auto?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCutDownResult = () => {
|
const getCutDownResult = () => {
|
||||||
@ -86,7 +86,7 @@ const getCutDownResult = () => {
|
|||||||
Object.assign({ currentTimeStamp, cutResult: imgData, orginal: orgInfo })
|
Object.assign({ currentTimeStamp, cutResult: imgData, orginal: orgInfo })
|
||||||
);
|
);
|
||||||
let newFile = dataURLtoFile(imgData);
|
let newFile = dataURLtoFile(imgData);
|
||||||
if (isInFormItem.value && props.withForm) {
|
if (!props.auto) {
|
||||||
emit("update:modelValue", [newFile]);
|
emit("update:modelValue", [newFile]);
|
||||||
clearLightCutEffect();
|
clearLightCutEffect();
|
||||||
return;
|
return;
|
||||||
@ -164,7 +164,7 @@ const props = withDefaults(defineProps<UploadProps>(), {
|
|||||||
cut: false,
|
cut: false,
|
||||||
cutOptions: void 0,
|
cutOptions: void 0,
|
||||||
modelValue: null,
|
modelValue: null,
|
||||||
withForm: false,
|
auto: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const slot = useSlots();
|
const slot = useSlots();
|
||||||
@ -180,10 +180,6 @@ const emit = defineEmits([
|
|||||||
"update:modelValue",
|
"update:modelValue",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const isInFormItem = computed(
|
|
||||||
() => context?.parent?.type.name === "LayFormItem"
|
|
||||||
);
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => props.modelValue,
|
||||||
() => {
|
() => {
|
||||||
@ -379,7 +375,7 @@ const uploadChange = (e: any) => {
|
|||||||
if (arm2) {
|
if (arm2) {
|
||||||
console.warn(cannotSupportCutMsg.value);
|
console.warn(cannotSupportCutMsg.value);
|
||||||
}
|
}
|
||||||
if (isInFormItem.value && props.withForm) {
|
if (!props.auto) {
|
||||||
emit("update:modelValue", _files);
|
emit("update:modelValue", _files);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ export default {
|
|||||||
<lay-textarea placeholder="请输入描述" v-model="validateModel.desc"></lay-textarea>
|
<lay-textarea placeholder="请输入描述" v-model="validateModel.desc"></lay-textarea>
|
||||||
</lay-form-item>
|
</lay-form-item>
|
||||||
<lay-form-item label="文件" prop="file">
|
<lay-form-item label="文件" prop="file">
|
||||||
<lay-upload v-model="validateModel.file" :cut="true" acceptMime="images" :withForm="true"/>
|
<lay-upload v-model="validateModel.file" :cut="true" acceptMime="images" :auto="false"/>
|
||||||
</lay-form-item>
|
</lay-form-item>
|
||||||
<lay-form-item>
|
<lay-form-item>
|
||||||
<lay-button @click="validate">提交</lay-button>
|
<lay-button @click="validate">提交</lay-button>
|
||||||
|
@ -262,7 +262,7 @@ export default {
|
|||||||
| cutOptions | 开启剪裁的模态弹窗与剪裁框的配置 | object | { layerOption,copperOption } | -- |
|
| cutOptions | 开启剪裁的模态弹窗与剪裁框的配置 | object | { layerOption,copperOption } | -- |
|
||||||
| text | 普通上传描述 | string | -- | -- |
|
| text | 普通上传描述 | string | -- | -- |
|
||||||
| dragText | 拖拽上传描述 | string | -- | -- |
|
| dragText | 拖拽上传描述 | string | -- | -- |
|
||||||
| withForm | 是否跟随表单提交 | boolean | false | -- |
|
| auto | 是否自动提交 | boolean | false | -- |
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user