BaseIcon.vue 737 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <script setup lang="ts">
  2. import { computed } from 'vue';
  3. const props = defineProps<{
  4. name: string
  5. width: number | string
  6. height: number | string
  7. color?: string
  8. }>()
  9. const domStyle = computed(() => ({
  10. width: props.width + 'px',
  11. height: props.height + 'px',
  12. }))
  13. </script>
  14. <template>
  15. <section class="icon-container" :style="{...domStyle, color: color}">
  16. <nuxt-icon :name="name" :filled="!color" style="width: 100%; height: 100%;"/>
  17. </section>
  18. </template>
  19. <style scoped lang="scss">
  20. .icon-container {
  21. .nuxt-icon {
  22. display: inline-block;
  23. width: 100%;
  24. height: 100%;
  25. :deep(svg) {
  26. width: 100%;
  27. height: 100%;
  28. margin-bottom: 0;
  29. }
  30. }
  31. }
  32. </style>