|
@@ -109,12 +109,14 @@ function beforeUpload(file) {
|
|
|
|
|
|
if (props.sizeLimit) {
|
|
|
const isLtSize = file.size / 1024 < props.sizeLimit;
|
|
|
- if (["png", "jpg", "jpeg"].includes(file.name?.split(".").at(-1))) {
|
|
|
+ const arr = file.name?.split('.')
|
|
|
+ const ext = arr[arr.length - 1].toLowerCase()
|
|
|
+ if (["png", "jpg", "jpeg"].includes(ext)) {
|
|
|
isPicture.value = "picture";
|
|
|
}
|
|
|
if (
|
|
|
["mp4", "ppt", "pptx", "xls", "xlsx"].includes(
|
|
|
- file.name?.split(".").at(-1)
|
|
|
+ ext
|
|
|
)
|
|
|
) {
|
|
|
isPicture.value = "text";
|
|
@@ -172,7 +174,9 @@ function onExceed() {
|
|
|
const dialogImageUrl = ref("");
|
|
|
const dialogVisible = ref(false);
|
|
|
const handlePictureCardPreview = (uploadFile) => {
|
|
|
- if (["png", "jpg", "jpeg"].includes(uploadFile.url?.split(".").at(-1))) {
|
|
|
+ const arr = uploadFile.url?.split('.')
|
|
|
+ const ext = arr[arr.length - 1].toLowerCase()
|
|
|
+ if (["png", "jpg", "jpeg"].includes(ext)) {
|
|
|
dialogImageUrl.value = uploadFile.url;
|
|
|
dialogVisible.value = true;
|
|
|
}
|