<template>
  <van-image :src="showSrc" :width="width" :height="height" :radius="radius" />
</template>
<script lang="ts" setup>
import { computed } from "vue";
import { getAssets, getStaticImage } from "@/utils";
const props = defineProps({
  src: {
    type: String,
    default: "",
    required: true,
  },
  width: {
    type: String,
    default: "",
    reqiured: false,
  },
  height: {
    type: String,
    default: "",
    reqiured: false,
  },
  radius: {
    type: String,
    default: "",
    required: false,
  },
  type: {
    type: String,
    default: "static",
    required: false,
    validator: (value: string) => {
      return ["local", "static"].includes(value);
    },
  },
});

const showSrc = computed(() => {
  return props.type == "local"
    ? getAssets(props.src)
    : getStaticImage(props.src);
});
</script>
