12345678910111213141516171819202122232425262728293031323334353637 |
- <template>
- <i :class="[name]" :style="[fontStyle]" class="icon"></i>
- </template>
- <script setup>
- import {computed} from "vue";
- const emits = defineEmits(['click'])
- const props = defineProps({
- name: String,
- // 字体大小
- size: {
- type: [Number, String],
- default: ''
- },
- color: {
- type: String,
- default: ''
- }
- })
- const onClick = () => {
- emits('click')
- }
- const fontStyle = computed(() => {
- const style = {}
- if (props.size) style.fontSize = props.size + uni.$uv.config.unit
- if (props.color) style.color = props.color
- return style
- })
- </script>
- <style scoped>
- </style>
|