Pārlūkot izejas kodu

feat: 优化宽度跟随

zhangyuhan 3 mēneši atpakaļ
vecāks
revīzija
917d6cf653
1 mainītis faili ar 13 papildinājumiem un 2 dzēšanām
  1. 13 2
      apps/bigmember_pc/src/views/subscribe/SubPush.vue

+ 13 - 2
apps/bigmember_pc/src/views/subscribe/SubPush.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="page--sub-push">
-    <div class="page-content">
+    <div class="page-content" ref='pageContent'>
       <div class="content-header">
         <span class="header-left card-title">{{ subscribeTitle }}</span>
         <div class="header-right">
@@ -339,7 +339,7 @@
         @viewDetailCallBack="viewDetailCallBack"
       ></SubscribeOverview>
     </DrawerCard>
-    <div v-if="urlPushTime" class="look-more-tips">
+    <div v-if="urlPushTime" class="look-more-tips" :style='{ width: tipWidth }'>
       <span>当前筛选查看的为此次推送的信息,</span>
       <span class="look-more-tips-btn" @click="doLookMoreData">点击查看全部></span>
     </div>
@@ -402,6 +402,7 @@ export default {
   data() {
     return {
       urlPushTime: '',
+      tipWidth: '100%',
       tip: {
         maxPushTip: false
       },
@@ -607,6 +608,10 @@ export default {
     await this.getSubScribeKeyList({ vt: this.vt })
     await this.getNewSubScribeKeyList(this.vt)
     this.moduleList = moreFiltersNeedVipKeyList()
+    window.addEventListener('resize', this.computedTipWidth)
+  },
+  beforeDestroy() {
+    window.removeEventListener('resize', this.computedTipWidth)
   },
   mounted() {
       this.initQuery()
@@ -619,6 +624,11 @@ export default {
   },
   methods: {
     ...mapActions('user', ['getEntInfo', 'getSubScribeKeyList']),
+    computedTipWidth () {
+      this.$nextTick(() => {
+        this.tipWidth = this.$refs.pageContent.clientWidth + 'px'
+      })
+    },
     checkPushTime () {
       // 首次进入清除缓存
       if (performance.navigation.type === 0) {
@@ -945,6 +955,7 @@ export default {
       const time = pushtime || times
       if (time) {
         this.urlPushTime = time
+        this.computedTipWidth()
         this.filters.pushTime = time
       }
       if (drawer) {