<template>
  <div
    ref="imageViewRef"
    class="image-view"
    @mouseover="(ev) => mouseoverImg(ev, src)"
    @mouseleave="mouseleaveImg"
  >
    <img :src="src" :style="imageStyle" />
  </div>
</template>
<script setup lang="ts">
import useImagePreview from '@/utils/hooks/useImagePreview.'
import { computed, defineProps } from 'vue'
const props = defineProps({
  src: {
    type: String,
    default: () => '',
  },
  width: {
    type: String,
    default: () => '30px',
  },
  height: {
    type: String,
    default: () => '30px',
  },
})
const imageStyle = computed(() => {
  return {
    width: props.width,
    height: props.height,
  }
})
const { mouseoverImg, mouseleaveImg } = useImagePreview()
</script>
<style lang="scss" scoped>
.image-view {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
</style>
