Upgraded dependencies, bumped to Node 24.
This commit is contained in:
@@ -1,49 +1,22 @@
|
||||
<template>
|
||||
<div class="tooltip-container">
|
||||
<div
|
||||
ref="handle"
|
||||
class="tooltip-handle"
|
||||
@click.stop="toggle"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-show="opened"
|
||||
class="tooltip-layer"
|
||||
>
|
||||
<div
|
||||
ref="tooltip"
|
||||
class="tooltip-wrapper"
|
||||
:style="{ transform: `translate(${position.x}px, ${position.y}px)` }"
|
||||
>
|
||||
<div
|
||||
class="tooltip"
|
||||
@click="close"
|
||||
>
|
||||
<slot
|
||||
name="tooltip"
|
||||
@click.stop
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
onMounted,
|
||||
onBeforeUnmount,
|
||||
nextTick,
|
||||
} from 'vue';
|
||||
|
||||
// import { useFloating } from '@floating-ui/vue';
|
||||
import { computePosition, shift } from '@floating-ui/dom';
|
||||
|
||||
import {
|
||||
nextTick,
|
||||
onBeforeUnmount,
|
||||
onMounted,
|
||||
ref,
|
||||
} from 'vue';
|
||||
|
||||
import events from '#/src/events.js';
|
||||
|
||||
const props = defineProps({
|
||||
placement: {
|
||||
type: String,
|
||||
default: 'top',
|
||||
},
|
||||
});
|
||||
const handle = ref(null);
|
||||
const tooltip = ref(null);
|
||||
const opened = ref(false);
|
||||
@@ -53,13 +26,6 @@ const position = ref({
|
||||
y: 0,
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
placement: {
|
||||
type: String,
|
||||
default: 'top',
|
||||
},
|
||||
});
|
||||
|
||||
async function open() {
|
||||
events.emit('blur');
|
||||
opened.value = true;
|
||||
@@ -97,7 +63,8 @@ function close() {
|
||||
function toggle() {
|
||||
if (opened.value) {
|
||||
close();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
open();
|
||||
}
|
||||
}
|
||||
@@ -111,6 +78,39 @@ onBeforeUnmount(() => {
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="tooltip-container">
|
||||
<div
|
||||
ref="handle"
|
||||
class="tooltip-handle"
|
||||
@click.stop="toggle"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-show="opened"
|
||||
class="tooltip-layer"
|
||||
>
|
||||
<div
|
||||
ref="tooltip"
|
||||
class="tooltip-wrapper"
|
||||
:style="{ transform: `translate(${position.x}px, ${position.y}px)` }"
|
||||
>
|
||||
<div
|
||||
class="tooltip"
|
||||
@click="close"
|
||||
>
|
||||
<slot
|
||||
name="tooltip"
|
||||
@click.stop
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.tooltip-layer {
|
||||
position: absolute;
|
||||
|
||||
Reference in New Issue
Block a user