popupPreviewFile.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <uni-popup ref="popupDialog" :is-mask-click="isMaskClick">
  3. <uni-icons @click="CloseDialog" class="colse" type="closeempty" size="24"></uni-icons>
  4. <image class="img_width" @click="CloseDialog" :src="filePath" mode="aspectFit"></image>
  5. </uni-popup>
  6. </template>
  7. <script setup>
  8. import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue';
  9. import {
  10. ref
  11. } from 'vue';
  12. const props = defineProps({
  13. isMaskClick:{//蒙版点击是否关闭弹窗
  14. type: Boolean,
  15. default: true
  16. },
  17. filePath:{//文件路径
  18. type: String,
  19. default: ''
  20. }
  21. })
  22. const popupDialog = ref(null);
  23. //打开弹窗
  24. const OpenDialog = () => {
  25. popupDialog.value?.open();
  26. }
  27. //关闭弹框
  28. const CloseDialog = () => {
  29. popupDialog.value?.close();
  30. }
  31. defineExpose({
  32. OpenDialog
  33. })
  34. </script>
  35. <style scoped lang="scss">
  36. :deep(.maskClass){
  37. background-color: rgba(0, 0, 0, 0.8) !important;
  38. }
  39. .img_width{
  40. width: 750rpx;
  41. height: 80vh;
  42. }
  43. .colse{
  44. position: fixed;
  45. box-sizing: border-box;
  46. top: 0px;
  47. right: 0px;
  48. width: 60px;
  49. height: 44px;
  50. padding: 6px;
  51. line-height: 32px;
  52. font-size: 26px;
  53. color: #fff !important;
  54. text-align: center;
  55. z-index:99;
  56. }
  57. </style>