update customer profile card
This commit is contained in:
@@ -1,19 +1,13 @@
|
||||
<template>
|
||||
<component
|
||||
:is="href ? 'a' : 'span'"
|
||||
v-if="displayText"
|
||||
:href="href || undefined"
|
||||
class="telephone-link"
|
||||
:class="{ clickable: !!href }"
|
||||
@click="handleClick"
|
||||
>
|
||||
<t-icon v-if="value" name="call" />
|
||||
<span v-text="displayText" />
|
||||
</component>
|
||||
<contact-number :value="value" @click="handleClick" underline>
|
||||
<template #icon>
|
||||
<t-icon v-if="value" name="call" />
|
||||
</template>
|
||||
</contact-number>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { buildTelephoneURL, canDialTelephone } from "@/utils/telephone";
|
||||
import { ContactNumber } from "timi-web";
|
||||
|
||||
defineOptions({
|
||||
name: "TelephoneLink"
|
||||
@@ -27,8 +21,6 @@ const props = withDefaults(defineProps<{
|
||||
});
|
||||
|
||||
const textValue = computed(() => props.value?.trim() || "");
|
||||
const displayText = computed(() => textValue.value || props.placeholder);
|
||||
const href = computed(() => canDialTelephone(textValue.value) ? buildTelephoneURL(textValue.value) : "");
|
||||
|
||||
function handleClick(event: MouseEvent): void {
|
||||
if (textValue.value) {
|
||||
@@ -42,10 +34,5 @@ function handleClick(event: MouseEvent): void {
|
||||
color: inherit;
|
||||
word-break: break-all;
|
||||
text-decoration: none;
|
||||
|
||||
&.clickable {
|
||||
text-decoration: underline;
|
||||
text-underline-offset: .16rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user