mount tippy on first element when tag is null
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue-tippy",
|
||||
"version": "6.1.0-beta.2",
|
||||
"version": "6.1.0",
|
||||
"main": "index.js",
|
||||
"module": "dist/vue-tippy.mjs",
|
||||
"unpkg": "dist/vue-tippy.iife.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<tippy content="Choose an aggregation for this area">
|
||||
<tippy content="Choose an aggregation for this area" :tag="null">
|
||||
<button class="text-sm py-2 px-3 bg-gray-900 text-white rounded-lg">Aggregation #1</button>
|
||||
</tippy>
|
||||
</div>
|
||||
|
||||
+22
-1
@@ -139,9 +139,30 @@ const TippyComponent = defineComponent({
|
||||
return () => {
|
||||
const slot = slots.default ? slots.default(exposed) : []
|
||||
|
||||
const tag = typeof props.tag === 'string' ? resolveComponent(props.tag as string) : props.tag
|
||||
const contentTag = typeof props.contentTag === 'string' ? resolveComponent(props.contentTag as string) : props.contentTag
|
||||
|
||||
if (!props.tag) {
|
||||
const trigger = h(slot[0] as any, {
|
||||
ref: elem, 'data-v-tippy': ''
|
||||
});
|
||||
|
||||
return slots.content ?
|
||||
[
|
||||
trigger, h(
|
||||
contentTag,
|
||||
{
|
||||
ref: contentElem,
|
||||
style: { display: mounted.value ? 'inherit' : 'none' },
|
||||
class: props.contentClass
|
||||
},
|
||||
slots.content(exposed)
|
||||
)
|
||||
]
|
||||
: trigger
|
||||
}
|
||||
|
||||
const tag = typeof props.tag === 'string' ? resolveComponent(props.tag as string) : props.tag
|
||||
|
||||
return h(tag, { ref: elem, 'data-v-tippy': '' }, slots.content ? [
|
||||
slot,
|
||||
h(
|
||||
|
||||
Reference in New Issue
Block a user