mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-11-04 12:18:43 +08:00 
			
		
		
		
	【功能优化】框架:UploadImgs 的 zIndex 9999999,避免遮挡问题
This commit is contained in:
		@@ -25,7 +25,7 @@
 | 
				
			|||||||
      <template #file="{ file }">
 | 
					      <template #file="{ file }">
 | 
				
			||||||
        <img :src="file.url" class="upload-image" />
 | 
					        <img :src="file.url" class="upload-image" />
 | 
				
			||||||
        <div class="upload-handle" @click.stop>
 | 
					        <div class="upload-handle" @click.stop>
 | 
				
			||||||
          <div class="handle-icon" @click="handlePictureCardPreview(file)">
 | 
					          <div class="handle-icon" @click="imagePreview(file.url!)">
 | 
				
			||||||
            <Icon icon="ep:zoom-in" />
 | 
					            <Icon icon="ep:zoom-in" />
 | 
				
			||||||
            <span>查看</span>
 | 
					            <span>查看</span>
 | 
				
			||||||
          </div>
 | 
					          </div>
 | 
				
			||||||
@@ -39,16 +39,12 @@
 | 
				
			|||||||
    <div class="el-upload__tip">
 | 
					    <div class="el-upload__tip">
 | 
				
			||||||
      <slot name="tip"></slot>
 | 
					      <slot name="tip"></slot>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
    <el-image-viewer
 | 
					 | 
				
			||||||
      v-if="imgViewVisible"
 | 
					 | 
				
			||||||
      :url-list="[viewImageUrl]"
 | 
					 | 
				
			||||||
      @close="imgViewVisible = false"
 | 
					 | 
				
			||||||
    />
 | 
					 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
<script lang="ts" setup>
 | 
					<script lang="ts" setup>
 | 
				
			||||||
import type { UploadFile, UploadProps, UploadUserFile } from 'element-plus'
 | 
					import type { UploadFile, UploadProps, UploadUserFile } from 'element-plus'
 | 
				
			||||||
import { ElNotification } from 'element-plus'
 | 
					import { ElNotification } from 'element-plus'
 | 
				
			||||||
 | 
					import { createImageViewer } from '@/components/ImageViewer'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { propTypes } from '@/utils/propTypes'
 | 
					import { propTypes } from '@/utils/propTypes'
 | 
				
			||||||
import { useUpload } from '@/components/UploadFile/src/useUpload'
 | 
					import { useUpload } from '@/components/UploadFile/src/useUpload'
 | 
				
			||||||
@@ -56,6 +52,13 @@ import { useUpload } from '@/components/UploadFile/src/useUpload'
 | 
				
			|||||||
defineOptions({ name: 'UploadImgs' })
 | 
					defineOptions({ name: 'UploadImgs' })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const message = useMessage() // 消息弹窗
 | 
					const message = useMessage() // 消息弹窗
 | 
				
			||||||
 | 
					// 查看图片
 | 
				
			||||||
 | 
					const imagePreview = (imgUrl: string) => {
 | 
				
			||||||
 | 
					  createImageViewer({
 | 
				
			||||||
 | 
					    zIndex: 9999999,
 | 
				
			||||||
 | 
					    urlList: [imgUrl]
 | 
				
			||||||
 | 
					  })
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type FileTypes =
 | 
					type FileTypes =
 | 
				
			||||||
  | 'image/apng'
 | 
					  | 'image/apng'
 | 
				
			||||||
@@ -178,14 +181,6 @@ const handleExceed = () => {
 | 
				
			|||||||
    type: 'warning'
 | 
					    type: 'warning'
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
// 图片预览
 | 
					 | 
				
			||||||
const viewImageUrl = ref('')
 | 
					 | 
				
			||||||
const imgViewVisible = ref(false)
 | 
					 | 
				
			||||||
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
 | 
					 | 
				
			||||||
  viewImageUrl.value = uploadFile.url!
 | 
					 | 
				
			||||||
  imgViewVisible.value = true
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<style lang="scss" scoped>
 | 
					<style lang="scss" scoped>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user