<script setup lang="ts">
const props = withDefaults(
    defineProps<{
        name: string;
        size?: string | number;
        color?: string;
        img?: boolean;
    }>(),
    { img: false, size: '40rpx' },
);

const emit = defineEmits(['click']);

defineOptions({
    options: {
        virtualHost: true,
    },
});
</script>
<template>
    <nut-icon
        v-if="props.img"
        :name="`https://box-1313840333.cos.ap-guangzhou.myqcloud.com/mobole-terminal/icon/${props.name}.svg`"
        :width="props.size"
        :height="props.size"
        @click="(e: anyObj) => emit('click', e)"
    ></nut-icon>
    <nut-icon
        v-else
        font-class-name="iconfont"
        class-prefix="icon"
        :name="props.name"
        :custom-color="props.color"
        :size="props.size"
        :width="props.size"
        :height="props.size"
        @click="(e: anyObj) => emit('click', e)"
    ></nut-icon>
</template>
<style lang="scss" scoped>
.iconfont {
    color: $uni-text-color;
}
</style>
