Selaa lähdekoodia

perf(components): 优化图标组件

1. 取消阻止点击事件冒泡
2. 将事件对象传递出去
wangcong 2 kuukautta sitten
vanhempi
sitoutus
e9456e209b
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      src/components/SvgIcon.vue

+ 2 - 2
src/components/SvgIcon.vue

@@ -14,7 +14,7 @@ interface Props extends IconObject {
 const props = defineProps<Props>();
 
 defineEmits<{
-  click: [];
+  click: [e: MouseEvent];
 }>();
 
 const iconClass = computed(() => {
@@ -31,5 +31,5 @@ const iconStyle = computed<CSSProperties>(() => {
 </script>
 
 <template>
-  <i :class="iconClass" :style="iconStyle" @click.stop="$emit('click')"></i>
+  <i :class="iconClass" :style="iconStyle" @click="$emit('click', $event)"></i>
 </template>