fix event bubble

This commit is contained in:
Timi
2026-08-03 17:27:49 +08:00
parent e3be14b0cc
commit 337700cfa7
+7 -1
View File
@@ -5,7 +5,7 @@
:href="href || undefined" :href="href || undefined"
class="telephone-link" class="telephone-link"
:class="{ clickable: !!href }" :class="{ clickable: !!href }"
@click.stop @click="handleClick"
> >
<span v-text="displayText" /> <span v-text="displayText" />
</component> </component>
@@ -28,6 +28,12 @@ const props = withDefaults(defineProps<{
const textValue = computed(() => props.value?.trim() || ""); const textValue = computed(() => props.value?.trim() || "");
const displayText = computed(() => textValue.value || props.placeholder); const displayText = computed(() => textValue.value || props.placeholder);
const href = computed(() => canDialTelephone(textValue.value) ? buildTelephoneURL(textValue.value) : ""); const href = computed(() => canDialTelephone(textValue.value) ? buildTelephoneURL(textValue.value) : "");
function handleClick(event: MouseEvent): void {
if (textValue.value) {
event.stopPropagation();
}
}
</script> </script>
<style scoped lang="less"> <style scoped lang="less">