对比新文件 |
| | |
| | | import { computed, defineComponent } from 'vue' |
| | | export default defineComponent({ |
| | | name: '鍥炬爣', |
| | | props: { |
| | | icon: { |
| | | type: String, |
| | | default: '', |
| | | }, |
| | | width: { |
| | | type: Number, |
| | | default: 12, |
| | | }, |
| | | height: { |
| | | type: Number, |
| | | default: 12, |
| | | }, |
| | | }, |
| | | emits: ['click'], |
| | | setup(props, { attrs, slots, emit }) { |
| | | const imgUrl = computed(() => { |
| | | const imgName = props.icon |
| | | return new URL(`../../assets/images/${imgName}.png`, import.meta.url).href |
| | | }) |
| | | |
| | | return () => { |
| | | return ( |
| | | <img |
| | | onClick={(evt: Event) => emit('click', evt)} |
| | | width={props.width} |
| | | height={props.height} |
| | | src={imgUrl.value} |
| | | {...attrs} |
| | | /> |
| | | ) |
| | | } |
| | | }, |
| | | }) |