From 928c61ccddebc8d2c697b86ee9bee0c207330a8c Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周二, 06 5月 2025 07:18:22 +0800 Subject: [PATCH] 222 --- HIAWms/web/src/components/Icon/Icon.tsx | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/HIAWms/web/src/components/Icon/Icon.tsx b/HIAWms/web/src/components/Icon/Icon.tsx new file mode 100644 index 0000000..5b5d157 --- /dev/null +++ b/HIAWms/web/src/components/Icon/Icon.tsx @@ -0,0 +1,37 @@ +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} + /> + ) + } + }, +}) -- Gitblit v1.9.3