From 4ea5de0c9a3c61d8312c80fd26843e41343a4067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Mon, 14 Nov 2022 10:14:21 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(component):=20=E8=B0=83=E6=95=B4=20up?= =?UTF-8?q?load=20=E6=96=87=E6=A1=A3,=20=E7=AE=80=E5=8C=96=20demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/src/component/upload/index.vue | 11 +-- .../src/document/zh-CN/components/form.md | 10 +-- .../src/document/zh-CN/components/upload.md | 69 +++++++++++-------- 3 files changed, 52 insertions(+), 38 deletions(-) diff --git a/package/component/src/component/upload/index.vue b/package/component/src/component/upload/index.vue index b9d4fef9..abd47dad 100644 --- a/package/component/src/component/upload/index.vue +++ b/package/component/src/component/upload/index.vue @@ -17,7 +17,7 @@ import { ref, useSlots, withDefaults, - watch, + watch } from "vue"; import { templateRef } from "@vueuse/core"; import { LayLayer } from "@layui/layer-vue"; @@ -172,6 +172,7 @@ const slots = slot.default && slot.default(); const context = getCurrentInstance(); const emit = defineEmits([ "choose", + "chooseAfter", "before", "done", "error", @@ -193,8 +194,8 @@ const isDragEnter = ref(false); const activeUploadFiles = ref([]); const activeUploadFilesImgs = ref([]); const orgFileInput = templateRef("orgFileInput"); -let _cropper: any = null; +let _cropper: any = null; let computedCutLayerOption: ComputedRef; if (props.cutOptions && props.cutOptions.layerOption) { @@ -269,9 +270,8 @@ const errorF = (errorText: string) => { }; const localUpload = (option: localUploadOption, callback: Function) => { - let xhr: XMLHttpRequest, url; - xhr = new XMLHttpRequest(); - url = option.url; + let xhr: XMLHttpRequest = new XMLHttpRequest(); + let url = option.url; let formData = option.formData; const cb = callback; xhr.onreadystatechange = function () { @@ -352,6 +352,7 @@ const uploadChange = (e: any) => { props.cut && props.acceptMime.indexOf("image") != -1 && props.multiple == false; + let arm2 = props.cut && props.acceptMime.indexOf("image") != -1 && 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 637b56bd..c06e2249 100644 --- a/package/document-component/src/document/zh-CN/components/form.md +++ b/package/document-component/src/document/zh-CN/components/form.md @@ -151,6 +151,7 @@ export default { ::: demo