mirror of
https://github.com/tenrok/vue-select.git
synced 2026-05-17 02:29:37 +03:00
f2479434e4
* fix: memory leak when positioning with popper * docs: update calculate position docs Co-authored-by: Jeff <sagalbot@gmail.com>
27 lines
830 B
JavaScript
27 lines
830 B
JavaScript
export default {
|
|
inserted (el, bindings, {context}) {
|
|
if (context.appendToBody) {
|
|
const {height, top, left} = context.$refs.toggle.getBoundingClientRect();
|
|
|
|
el.unbindPosition = context.calculatePosition(el, context, {
|
|
width: context.$refs.toggle.clientWidth + 'px',
|
|
top: (window.scrollY + top + height) + 'px',
|
|
left: (window.scrollX + left) + 'px',
|
|
});
|
|
|
|
document.body.appendChild(el);
|
|
}
|
|
},
|
|
|
|
unbind (el, bindings, {context}) {
|
|
if (context.appendToBody) {
|
|
if (el.unbindPosition && typeof el.unbindPosition === 'function') {
|
|
el.unbindPosition();
|
|
}
|
|
if (el.parentNode) {
|
|
el.parentNode.removeChild(el);
|
|
}
|
|
}
|
|
},
|
|
}
|