Преглед на файлове

Merge branch 'dev/v1.0.9_zsy' of jianyu/page_pc_stationSocial into feature/v1.0.9

zhangsiya преди 11 месеца
родител
ревизия
d4a01168d0
променени са 2 файла, в които са добавени 25 реда и са изтрити 1 реда
  1. 1 0
      src/assets/style/in-app.scss
  2. 24 1
      src/components/problem-tag/select-tag.vue

+ 1 - 0
src/assets/style/in-app.scss

@@ -4,5 +4,6 @@
     height: calc(100% - 48px);
     max-width: unset;
     margin: 24px;
+    overflow-x: auto;
   }
 }

+ 24 - 1
src/components/problem-tag/select-tag.vue

@@ -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