fix: 默认剪裁功能丢失原图片信息

This commit is contained in:
lockingreal 2022-04-14 08:18:25 +08:00
parent 1864762de5
commit 3d09afd587

View File

@ -61,7 +61,7 @@ export interface LayUploadProps {
number?: number;
drag?: boolean;
disabled?: boolean;
disabledPreview?:boolean;
disabledPreview?: boolean;
cut?: boolean;
cutOptions: cutOptions;
}
@ -71,7 +71,9 @@ const getCutDownResult = () => {
const canvas = _cropper.getCroppedCanvas();
let imgData = canvas.toDataURL('"image/png"');
let currentTimeStamp = new Date().valueOf();
emit("cutdone", Object.assign({ currentTimeStamp, msg: imgData }));
let orgInfo = activeUploadFiles.value[0];
console.log(orgInfo);
emit("cutdone", Object.assign({ currentTimeStamp, cutResult: imgData,orginal:orgInfo }));
let newFile = dataURLtoFile(imgData);
commonUploadTransaction([newFile]);
nextTick(() => clearAllCutEffect());
@ -113,7 +115,7 @@ const props = withDefaults(defineProps<LayUploadProps>(), {
number: 0,
drag: false,
disabled: false,
disabledPreview:false,
disabledPreview: false,
cut: false,
cutOptions: void 0,
});
@ -350,7 +352,10 @@ const cutTransaction = () => {};
// -> end
</script>
<template>
<div class="layui-upload layui-upload-wrap" :class="disabledPreview?'layui-upload-file-disabled':''">
<div
class="layui-upload layui-upload-wrap"
:class="disabledPreview ? 'layui-upload-file-disabled' : ''"
>
<input
class="layui-upload-file"
@click="clickOrgInput"
@ -417,7 +422,10 @@ const cutTransaction = () => {};
/>
</div>
</lay-layer>
<div class="layui-upload-list" :class="disabledPreview?'layui-upload-list-disabled':''">
<div
class="layui-upload-list"
:class="disabledPreview ? 'layui-upload-list-disabled' : ''"
>
<slot name="preview"></slot>
</div>
</div>