fix : 修复文件不能预览时的提示
This commit is contained in:
@@ -14,6 +14,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import {ElNotification} from "element-plus";
|
||||||
|
|
||||||
const emit = defineEmits(["update:fileUrl"])
|
const emit = defineEmits(["update:fileUrl"])
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
fileUrl: {
|
fileUrl: {
|
||||||
@@ -35,14 +37,20 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
const showPreview = ref(true)
|
const showPreview = ref(true)
|
||||||
const checkImgType=(fileType)=>{
|
console.info("🚀 ~method:fileType -----", props.fileType)
|
||||||
if(fileType=='png'||fileType=='jpg'||fileType=='jpeg'||fileType=='ico'||fileType=='PNG'||fileType=='JPG'){
|
|
||||||
return true
|
|
||||||
}else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user