g-icon-fonts.vue 565 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <text
  3. :style="{ color: props.color, 'font-size': props.size + 'px' }"
  4. :class="`iconfont icon-${props.name}`"
  5. @click="theClick"
  6. ></text>
  7. </template>
  8. <script lang="ts" setup>
  9. const props = defineProps({
  10. name: {
  11. type: String,
  12. default: "",
  13. },
  14. color: {
  15. type: String,
  16. default: "var(--theme-grey-icon-color)",
  17. },
  18. size: {
  19. type: [Number, String],
  20. default: 16,
  21. },
  22. });
  23. const emit = defineEmits<{
  24. (e: "click"): void;
  25. }>();
  26. function theClick() {
  27. emit("click");
  28. }
  29. </script>
  30. <style scoped lang="scss"></style>