This commit is contained in:
2024-09-24 17:04:44 +08:00
parent 6cd84e0021
commit 30528311c1
77 changed files with 2251 additions and 1361 deletions

View File

@@ -74,7 +74,10 @@ const _sfc_main = defineComponent({
let imgData = canvas.toDataURL('"image/png"');
let currentTimeStamp = new Date().valueOf();
let orgInfo = activeUploadFiles.value[0];
emit("cutdone", Object.assign({ currentTimeStamp, cutResult: imgData, orginal: orgInfo }));
emit(
"cutdone",
Object.assign({ currentTimeStamp, cutResult: imgData, orginal: orgInfo })
);
let newFile = dataURLtoFile(imgData);
if (!props.auto) {
emit("update:modelValue", [newFile]);
@@ -139,11 +142,14 @@ const _sfc_main = defineComponent({
const slot = useSlots();
slot.default && slot.default();
getCurrentInstance();
watch(() => props.modelValue, () => {
if (!props.modelValue) {
clearAllCutEffect();
watch(
() => props.modelValue,
() => {
if (!props.modelValue) {
clearAllCutEffect();
}
}
});
);
const isDragEnter = ref(false);
const activeUploadFiles = ref([]);
const activeUploadFilesImgs = ref([]);
@@ -151,7 +157,9 @@ const _sfc_main = defineComponent({
let _cropper = null;
let computedCutLayerOption;
if (props.cutOptions && props.cutOptions.layerOption) {
computedCutLayerOption = computed(() => Object.assign(defaultCutLayerOption, props.cutOptions.layerOption));
computedCutLayerOption = computed(
() => Object.assign(defaultCutLayerOption, props.cutOptions.layerOption)
);
} else {
computedCutLayerOption = computed(() => defaultCutLayerOption.value);
}
@@ -214,7 +222,10 @@ const _sfc_main = defineComponent({
if (xhr.readyState === 1) {
if (xhr.status >= 200 && xhr.status <= 300 || xhr.status === 304 || xhr.status == 0) {
let successText = startUploadMsg.value;
emit("before", Object.assign({ currentTimeStamp: currentTimeStamp2, msg: successText, ...option }));
emit(
"before",
Object.assign({ currentTimeStamp: currentTimeStamp2, msg: successText, ...option })
);
}
} else if (xhr.readyState === 4) {
let successText = xhr.responseText ? xhr.responseText : uploadSuccess;