feat: add vue component example to playground
This commit is contained in:
@@ -188,6 +188,13 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-6">
|
||||||
|
<span class="font-semibold mr-4">useTippy + vue component:</span>
|
||||||
|
<UiButton ref="vueComponentButton">
|
||||||
|
Vue component Button
|
||||||
|
</UiButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
<span class="font-semibold mr-4"
|
<span class="font-semibold mr-4"
|
||||||
>Tippy component + change content and props realtime using component
|
>Tippy component + change content and props realtime using component
|
||||||
@@ -300,6 +307,7 @@ import {
|
|||||||
} from 'vue'
|
} from 'vue'
|
||||||
import { useSingleton, useTippy, TippyOptions, TippyComponent } from '../../src'
|
import { useSingleton, useTippy, TippyOptions, TippyComponent } from '../../src'
|
||||||
import Counter from '../components/Counter.vue'
|
import Counter from '../components/Counter.vue'
|
||||||
|
import UiButton from '../components/Button.vue'
|
||||||
|
|
||||||
function useMousePosition() {
|
function useMousePosition() {
|
||||||
const x = ref(0)
|
const x = ref(0)
|
||||||
@@ -324,6 +332,7 @@ function useMousePosition() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
components: { UiButton },
|
||||||
setup() {
|
setup() {
|
||||||
const counter = ref<number>(0)
|
const counter = ref<number>(0)
|
||||||
|
|
||||||
@@ -398,6 +407,12 @@ export default defineComponent({
|
|||||||
triggerTarget: button7,
|
triggerTarget: button7,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const vueComponentButton = ref()
|
||||||
|
|
||||||
|
useTippy(vueComponentButton, {
|
||||||
|
content: 'Test Vue component',
|
||||||
|
})
|
||||||
|
|
||||||
const { x, y } = useMousePosition()
|
const { x, y } = useMousePosition()
|
||||||
|
|
||||||
const { tippy } = useTippy(() => document.body, {
|
const { tippy } = useTippy(() => document.body, {
|
||||||
@@ -478,6 +493,7 @@ export default defineComponent({
|
|||||||
button6Inc,
|
button6Inc,
|
||||||
button7,
|
button7,
|
||||||
target7,
|
target7,
|
||||||
|
vueComponentButton,
|
||||||
tippyComponent1,
|
tippyComponent1,
|
||||||
log: console.log,
|
log: console.log,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user