This commit is contained in:
parent
df79f7e58d
commit
0276394b0c
@ -8,7 +8,7 @@
|
|||||||
:disabled="!tooltipEnabled"
|
:disabled="!tooltipEnabled"
|
||||||
:ui="{ text: 'whitespace-normal break-words', content: 'max-w-50 h-auto' }"
|
:ui="{ text: 'whitespace-normal break-words', content: 'max-w-50 h-auto' }"
|
||||||
>
|
>
|
||||||
<span :class="textPrimary ? 'short-text--primary' : ''">{{ text }}</span>
|
<span :ref="checkSize" :class="textPrimary ? 'short-text--primary' : ''">{{ text }}</span>
|
||||||
<Icon
|
<Icon
|
||||||
v-if="tooltipEnabled"
|
v-if="tooltipEnabled"
|
||||||
name="heroicons:information-circle"
|
name="heroicons:information-circle"
|
||||||
@ -24,13 +24,13 @@
|
|||||||
:disabled="!tooltipEnabled"
|
:disabled="!tooltipEnabled"
|
||||||
:ui="{ text: 'whitespace-normal break-words', content: 'max-w-80 h-auto' }"
|
:ui="{ text: 'whitespace-normal break-words', content: 'max-w-80 h-auto' }"
|
||||||
>
|
>
|
||||||
<span :class="textPrimary ? 'short-text--primary' : ''">{{ text }}</span>
|
<span :ref="checkSize" :class="textPrimary ? 'short-text--primary' : ''">{{ text }}</span>
|
||||||
</UTooltip>
|
</UTooltip>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onClickOutside } from '@vueuse/core'
|
import { onClickOutside, unrefElement } from '@vueuse/core'
|
||||||
|
|
||||||
defineProps<{ text: string, textPrimary?: boolean }>()
|
defineProps<{ text: string, textPrimary?: boolean }>()
|
||||||
|
|
||||||
@ -43,6 +43,12 @@ const { isMobile } = useScreen()
|
|||||||
onClickOutside(wrapper, () => {
|
onClickOutside(wrapper, () => {
|
||||||
open.value = false
|
open.value = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function checkSize(_el: HTMLElement) {
|
||||||
|
const el = unrefElement(_el)
|
||||||
|
|
||||||
|
tooltipEnabled.value = el ? el.scrollWidth > el.clientWidth : false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user