File tree Expand file tree Collapse file tree 2 files changed +32
-12
lines changed
documentation/src/components Expand file tree Collapse file tree 2 files changed +32
-12
lines changed Original file line number Diff line number Diff line change 317317 <td class =" table__td" ><kbd >false</kbd ></td >
318318 <td class =" table__td" >Passes the Boolean value to the inbuilt <kbd >input</kbd > element.<br /><b >Added in v3.1.0</b ></td >
319319 </tr >
320+ <tr class =" table__tr" >
321+ <td class =" table__td" ><strong >useTeleport</strong ></td >
322+ <td class =" table__td" >Boolean</td >
323+ <td class =" table__td" ><kbd >false</kbd ></td >
324+ <td class =" table__td" >Uses Vue Teleport's feature. Teleports the open dropdown to the bottom of the <kbd >body</kbd > element.<br /><b >Added in v3.4.0</b ></td >
325+ </tr >
320326 <tr class =" table__tr" >
321327 <td class =" table__td utils--center" colspan =" 4" ><strong >pointerMixin.js</strong ></td >
322328 </tr >
Original file line number Diff line number Diff line change 9292 </slot >
9393 </span >
9494 </div >
95- <teleport to =" body" >
95+ <teleport to =" body" :disabled = " !useTeleport " >
9696 <transition name =" multiselect" >
9797 <div
9898 class =" multiselect__content-wrapper"
@@ -337,6 +337,15 @@ export default {
337337 required: {
338338 type: Boolean ,
339339 default: false
340+ },
341+ /**
342+ * Uses Vue Teleport's feature. Teleports the open dropdown to the bottom of the body element
343+ * @default false
344+ * @type {Boolean}
345+ */
346+ useTeleport: {
347+ type: Boolean ,
348+ default: false
340349 }
341350 },
342351 data () {
@@ -429,18 +438,23 @@ export default {
429438 watch: {
430439 isOpen (val ) {
431440 if (val) {
432- this .ready = false
433- this .$nextTick (() => {
434- const rect = this .$el .getBoundingClientRect ()
435- this .dropdownStyles = {
436- position: ' absolute' ,
437- top: ` ${ rect .bottom + window .scrollY } px` ,
438- left: ` ${ rect .left + window .scrollX } px` ,
439- width: ` ${ rect .width } px` ,
440- zIndex: 9999
441- }
441+ if (this .useTeleport ) {
442+ this .ready = false
443+ // This helps with the positioning of the open dropdown when teleport is being used
444+ this .$nextTick (() => {
445+ const rect = this .$el .getBoundingClientRect ()
446+ this .dropdownStyles = {
447+ position: ' absolute' ,
448+ top: ` ${ rect .bottom + window .scrollY } px` ,
449+ left: ` ${ rect .left + window .scrollX } px` ,
450+ width: ` ${ rect .width } px` ,
451+ zIndex: 9999
452+ }
453+ this .ready = true
454+ })
455+ } else {
442456 this .ready = true
443- })
457+ }
444458 }
445459 }
446460 }
You can’t perform that action at this time.
0 commit comments