<template>
  <up-image :src="src" @click="clickImage(src)"></up-image>
</template>
<script setup lang="ts">
interface Props {
  src: string;
  preview?: boolean; //是否需要预览
}
const props = withDefaults(defineProps<Props>(), {
  preview: true,
});
const emit = defineEmits(["click"]);
const clickImage = (src: string) => {
  if (props.preview) {
    uni.previewImage({
      current: 0,
      urls: [src],
    });
  } else emit("click", src);
};
</script>
<style lang="scss" scoped></style>
