1👍
✅
In that case, there’re two ways to solve this:
-
Change
v-if
tov-show
-
Add different
key
attributes to theDatepicker
components (Vue will know that this is two different components)
In fact, this is not a bug. You use the same component in v-if
and v-else
. The two component properties are basically the same, so Vue will reuse the previous components, but you should avoid multiplexing complex components in Vue. It’s easy to go wrong, which is why you must add a key
in v-for
in vue.
You did not modify the internal reference this.$refs.reference
when you reused the component, and the position of the popover cannot be calculated correctly.
Source:stackexchange.com