floating-vue icon indicating copy to clipboard operation
floating-vue copied to clipboard

Make v-popover follow the element when it is dragged

Open panayotisk opened this issue 4 years ago • 4 comments

I would like to know the recommended approach for having the popover automatically update its position when the target element position is changed. I saw that popper.js has a method to manually update via instance.update() but how do I get the popper instance from v-popover?

panayotisk avatar Jun 09 '21 15:06 panayotisk

I finally did it (in a bit hacky way) as follows:

  • Gave the v-popover a vue ref:
<v-popover
      ref="pop"
     ... 
>
  • In my drag handler called the component's popperInstance's update: this.$refs.pop.popperInstance.update(); However, this depends on the internal implementation of v-popover and cannot be considered a final solution. I will be leaving this issue open.

panayotisk avatar Jun 24 '21 09:06 panayotisk

was also looking for this. since i am working with range bars the tooltip does not stick. Will see if i can manage this workaround :D

Fanna1119 avatar Nov 27 '21 06:11 Fanna1119

Looking for this too.. any luck? I'm using vue3 so i couldn't get popperInstance to work

naaadz avatar Jul 08 '22 01:07 naaadz

Looking for this too.. any luck? I'm using vue3 so i couldn't get popperInstance to work

This is also a hack, but you can call onResize on a Dropdown instance like this:

<script lang="ts" setup>
import { ref } from 'vue'

const dropdown = ref(null)

// ...

function doSomething() {
  dropdown.value.onResize()
}
</script>

<template>
<VDropdown ref="dropdown" />
</template>

radusuciu avatar Nov 14 '22 23:11 radusuciu