diff --git a/securityManagement/src/components/upload/SingleImageFileUpload.vue b/securityManagement/src/components/upload/SingleImageFileUpload.vue index caadc2c..d4518bb 100644 --- a/securityManagement/src/components/upload/SingleImageFileUpload.vue +++ b/securityManagement/src/components/upload/SingleImageFileUpload.vue @@ -9,7 +9,7 @@ /> {{ btnLabel }} - + @@ -34,7 +34,7 @@ const props = withDefaults( width?: string | number; height?: string | number; btnLabel?: string; - idFile?: string | any; + id?: string | any; }>(), { parentDir: "", @@ -43,7 +43,7 @@ const props = withDefaults( width: "150px", height: "150px", btnLabel: "选择图片", - idFile: "myFileInput", + id: "myFileInput", } ); @@ -54,7 +54,7 @@ const uploadUrl = ref(); const fileInput = ref(null); const selectFile = () => { - document.getElementById(props.idFile)?.click(); + document.getElementById(props.id)?.click(); }; async function inputFileListener(this: HTMLInputElement) { @@ -107,13 +107,13 @@ const fileDelete = () => { }; onMounted(() => { document - .getElementById(props.idFile) + .getElementById(props.id) ?.addEventListener("change", inputFileListener); }); onUnmounted(() => { document - .getElementById(props.idFile) + .getElementById(props.id) ?.removeEventListener("change", inputFileListener); }); defineExpose({ fileDelete });