Commit e4754c03 by 乔延琦

Merge branch 'develop-yuancheng' into 'develop'

fix: popover滚动问题

See merge request GFP/RBC/rbc-frontend!47
parents 16a92500 d716c521
<template> <template>
<div class="rbc-basedata"> <div class="rbc-basedata">
<el-popover trigger="manual" v-model="dataListShow" :visible-arrow="false" :width="searchPopperMinWidth"> <el-popover ref="popover" trigger="manual" v-model="dataListShow" :visible-arrow="false" :width="searchPopperMinWidth">
<div class="select-box" slot="reference"> <div class="select-box" slot="reference">
<Input ref="searchInput" v-model="selectValue" :disabled="disabled" :readonly="readonly || multiple" :class="{'multiple-input': multiple && !readonly}" placeholder="" @on-change="handleChange" @on-focus="handleFocus" @on-blur="handleBlur" @keydown.down.native="handleSelectNext" @keydown.up.native="handleSelectPrev" @keydown.enter.native="handleSelected"> <Input ref="searchInput" v-model="selectValue" :disabled="disabled" :readonly="readonly || multiple" :class="{'multiple-input': multiple && !readonly}" placeholder="" @on-change="handleChange" @on-focus="handleFocus" @on-blur="handleBlur" @keydown.down.native="handleSelectNext" @keydown.up.native="handleSelectPrev" @keydown.enter.native="handleSelected">
<Icon type="ios-close-circle" :class="{'clear-icon': true, 'hidden-icon': disabled || readonly || !selectValue }" slot="suffix" @click="clearList" /> <Icon type="ios-close-circle" :class="{'clear-icon': true, 'hidden-icon': disabled || readonly || !selectValue }" slot="suffix" @click="clearList" />
...@@ -104,9 +104,38 @@ export default { ...@@ -104,9 +104,38 @@ export default {
} }
}, },
mounted () { mounted () {
this.addDomListener()
addResizeListener(this.$el, this.handleResize) addResizeListener(this.$el, this.handleResize)
}, },
beforeDestroy() {
this.removeDomListener()
},
methods: { methods: {
addDomListener() {
if (this.isVxe) {
let doms = document.querySelectorAll('.rootClass')
if (doms.length) {
doms.forEach(item => {
item.addEventListener('scroll', this.refreshPopover)
})
}
}
},
removeDomListener() {
if (this.isVxe) {
let doms = document.querySelectorAll('.rootClass')
if (doms.length) {
doms.forEach(item => {
item.removeEventListener('scroll', this.refreshPopover)
})
}
}
},
refreshPopover() {
if (this.dataListShow) {
this.$refs.popover.updatePopper()
}
},
handleResize () { handleResize () {
this.searchPopperMinWidth = this.$el.getBoundingClientRect().width this.searchPopperMinWidth = this.$el.getBoundingClientRect().width
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment