From ceacb11f6e943a882ae68cf7eca6dd19efab6923 Mon Sep 17 00:00:00 2001 From: lideqin <694785430@qq.com> Date: Mon, 29 Jan 2024 09:39:47 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BF=AE=E6=94=B9bug80175,81310?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/JMultipleDatePicker.vue | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/JMultipleDatePicker.vue b/src/components/JMultipleDatePicker.vue index 31d47ff1..3e7a2a52 100644 --- a/src/components/JMultipleDatePicker.vue +++ b/src/components/JMultipleDatePicker.vue @@ -6,7 +6,6 @@ :ref="fieldName" :dropdownClassName="'j-multiple-date-picker ' + fieldName + '-drop'" @openChange="handleOpenChange" - :getCalendarContainer="(trigger) => trigger.parentNode" style="width: 100%" v-bind="$attrs" > @@ -57,9 +56,28 @@ export default { console.log(open) if (open) { this.open = open - setTimeout(() => { - document.getElementsByClassName(this.fieldName + '-drop')[0].children[0].children[0].children[0].children[0].children[0].value = this.checkedValue.join(',') - }, 100) + this.$nextTick(() => { + // 为了固定弹出层,把弹出层dom元素移动 + const drop = document.getElementsByClassName(this.fieldName + '-drop')[0] + const picker = document.getElementById(this.fieldName) + // 创建第二层外层元素 + const outerWrapperTwo = document.createElement('div') + outerWrapperTwo.appendChild(drop) + // 创建新的外层元素 + const outerWrapper = document.createElement('div') + outerWrapper.style.position = 'absolute' + outerWrapper.style.top = '0px' + outerWrapper.style.left = '0px' + outerWrapper.style.width = '100%' + outerWrapper.appendChild(outerWrapperTwo) + picker.appendChild(outerWrapper) + this.$nextTick(() => { + document.getElementsByClassName(this.fieldName + '-drop')[0].children[0].children[0].children[0].children[0].children[0].value = this.checkedValue.join(',') + }) + }) + // setTimeout(() => { + // document.getElementsByClassName(this.fieldName + '-drop')[0].children[0].children[0].children[0].children[0].children[0].value = this.checkedValue.join(',') + // }, 100) } else { this.open = open this.$nextTick(() => {