ly-icon.vue 607 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <i :class="[name]" :style="[fontStyle]" class="icon"></i>
  3. </template>
  4. <script setup>
  5. import {computed} from "vue";
  6. const emits = defineEmits(['click'])
  7. const props = defineProps({
  8. name: String,
  9. // 字体大小
  10. size: {
  11. type: [Number, String],
  12. default: ''
  13. },
  14. color: {
  15. type: String,
  16. default: ''
  17. }
  18. })
  19. const onClick = () => {
  20. emits('click')
  21. }
  22. const fontStyle = computed(() => {
  23. const style = {}
  24. if (props.size) style.fontSize = props.size + uni.$uv.config.unit
  25. if (props.color) style.color = props.color
  26. return style
  27. })
  28. </script>
  29. <style scoped>
  30. </style>