fix : 修复文件不能预览时的提示

This commit is contained in:
2024-09-07 18:22:54 +08:00
parent fc41bd8e6d
commit b90d3bc466

View File

@@ -14,6 +14,8 @@
</template>
<script setup>
import {ElNotification} from "element-plus";
const emit = defineEmits(["update:fileUrl"])
const props = defineProps({
fileUrl: {
@@ -35,14 +37,20 @@ const props = defineProps({
}
})
const showPreview = ref(true)
const checkImgType=(fileType)=>{
if(fileType=='png'||fileType=='jpg'||fileType=='jpeg'||fileType=='ico'||fileType=='PNG'||fileType=='JPG'){
return true
}else {
return false
}
}
console.info("🚀 ~method:fileType -----", props.fileType)
const checkImgType=(fileType)=>{
return fileType == 'png' || fileType == 'jpg' || fileType == 'jpeg' || fileType == 'ico' || fileType == 'PNG' || fileType == 'JPG';
}
console.info("🚀 ~method:checkImgType(props.fileType) -----", checkImgType(props.fileType))
if(props.fileType!=='pdf'&&props.fileType!=='docx'&&!checkImgType(props.fileType)){
showPreview.value=false
ElNotification({
title: '提示',
message: props.fileName+' 文件不支持预览!',
type: 'error'
})
}
</script>
<style lang="scss">