|
@@ -54,7 +54,8 @@ export default {
|
|
|
list: [],
|
|
|
childrenList: [],
|
|
|
pActive: 0,
|
|
|
- pTimer: false
|
|
|
+ pTimer: false,
|
|
|
+ timer: null
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
@@ -64,6 +65,9 @@ export default {
|
|
|
_this.show = false
|
|
|
})
|
|
|
},
|
|
|
+ beforeDestroy () {
|
|
|
+ if (this.timer) clearTimeout(this.timer)
|
|
|
+ },
|
|
|
methods: {
|
|
|
async getList () {
|
|
|
const { error_code: code, data = [] } = await getProblemLabel()
|
|
@@ -177,6 +181,25 @@ export default {
|
|
|
this.show = !this.show
|
|
|
this.childrenList = this.list[0].children
|
|
|
this.pActive = 0
|
|
|
+ if (this.show) {
|
|
|
+ this.calcPopoverPosition()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 处理问题:由于外层overflow:hidden,元素也不能插入body,但是父元素其他内容过长,所剩底部区域过小时,popover展示不全
|
|
|
+ calcPopoverPosition () {
|
|
|
+ const parent = document.querySelector('#customer-info')
|
|
|
+ const parentRect = parent.getBoundingClientRect()
|
|
|
+ const elementRect = this.$el.getBoundingClientRect()
|
|
|
+ const bottom = parentRect.bottom - elementRect.bottom
|
|
|
+ if (bottom < 260 && this.$refs.selectTagRef) {
|
|
|
+ const popover = this.$refs.selectTagRef
|
|
|
+ if (popover) {
|
|
|
+ if (this.timer) clearTimeout(this.timer)
|
|
|
+ this.timer = setTimeout(() => {
|
|
|
+ popover.popperElm.style.top = (elementRect.bottom - 350) + 'px'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
cancelHandle () {
|
|
|
this.show = false
|