mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-19 09:50:33 +03:00
fix: use width from getBoundingClientRect as the default for calculatePosition (#1114)
* fix: use box-sizing: border-box; on dropdown menu Co-authored-by: Jeff <sagalbot@gmail.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
export default {
|
export default {
|
||||||
inserted (el, bindings, {context}) {
|
inserted (el, bindings, {context}) {
|
||||||
if (context.appendToBody) {
|
if (context.appendToBody) {
|
||||||
const {height, top, left} = context.$refs.toggle.getBoundingClientRect();
|
const {height, top, left, width} = context.$refs.toggle.getBoundingClientRect();
|
||||||
|
|
||||||
el.unbindPosition = context.calculatePosition(el, context, {
|
el.unbindPosition = context.calculatePosition(el, context, {
|
||||||
width: context.$refs.toggle.clientWidth + 'px',
|
width: width + 'px',
|
||||||
top: (window.scrollY + top + height) + 'px',
|
top: (window.scrollY + top + height) + 'px',
|
||||||
left: (window.scrollX + left) + 'px',
|
left: (window.scrollX + left) + 'px',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ $max-height: $vs-dropdown-max-height;
|
|||||||
|
|
||||||
.vs__dropdown-menu {
|
.vs__dropdown-menu {
|
||||||
display: block;
|
display: block;
|
||||||
|
box-sizing: border-box;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: calc(100% - #{$border-width}); // -{#$border-width} here ensures the left and right borders of the dropdown appear flush with the toggle.
|
top: calc(100% - #{$border-width}); // -{#$border-width} here ensures the left and right borders of the dropdown appear flush with the toggle.
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user