value
2024-05-16 083c818af77d33d619dba3dc20f94e996225a1c7
src/view/notice.vue
@@ -34,7 +34,7 @@
      </el-dropdown>
    </div>
    <div class="notice-content" v-loading="loading">
      <scroll-pagination @load="refresh" :finishLoding="finishLoding">
      <scroll-pagination @load="refresh" :finishLoding="finishLoding" :list="list">
        <div class="notice-content-item" v-for="(m,i) in list" :key="i">
          <div class="btns" v-if="m">
            <!-- v-if="m.messageType==2||m.messageType==3" -->
@@ -125,17 +125,27 @@
      pageSize: 8, // 一页7条
      total: null,
      loading: true, // 组件loading的展示,默认为true
      finishLoding: false // 加载完成,显示已经没有更多了
      finishLoding: false, // 加载完成,显示已经没有更多了
      keyMap:{}
    }
  },
  mounted(){
    this.getTypeDicts();
    this.currentPage = 1;
    this.keyMap = {};
    this.list = [];
    this.refresh();
  },
  methods:{
    refresh(){
      const key = `_${this.currentPage}`
      const value = this.keyMap[key]
      // 如果value存在,表示缓存有值,那么阻止请求
      if(value) {
        return
      }
      // value不存在,表示第一次请求,设置占位
      this.keyMap[key] = 'temp'
      if(this.currentPage==1){
        this.loading = true
      }
@@ -191,6 +201,7 @@
          p: "abcd"
        },29);
        this.list = [];
        this.keyMap = {};
        this.currentPage = 1;
        this.refresh();
        this.$emit('goNoticeDetail')
@@ -217,6 +228,7 @@
          }
          this.$message.success('删除成功')
          this.list = [];
          this.keyMap = {};
          this.currentPage = 1;
          this.refresh()
        }).catch(e => {
@@ -226,6 +238,7 @@
    },
    handleType(){
      this.list = [];
      this.keyMap = {};
      this.currentPage = 1;
      this.refresh();
    },
@@ -240,6 +253,7 @@
        }
        this.$message.success('操作成功')
        this.list = [];
        this.keyMap = {};
        this.currentPage = 1;
        this.refresh();
      })