[Vuejs]-How fix datepicker calendar position in element-ui

1👍

In that case, there’re two ways to solve this:

  1. Change v-if to v-show

  2. Add different key attributes to the Datepicker 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.

👤sugars

Leave a comment