licp
2024-05-14 2caf6c0b519300a24788b7cd8d57fb0c1f0b1a0e
src/components/view/a6-device-overview.vue
@@ -148,11 +148,11 @@
         </div>
         <div class="search_thing" style="padding-left: 30px;">
            <el-button size="small" @click="refresh()">重 置</el-button>
            <el-button size="small" type="primary" @click="currentPage= 1,list=[],finishLoding = false,refreshTable()">查 询</el-button>
            <el-button size="small" type="primary" @click="currentPage= 1,keyMap = {},list=[],finishLoding = false,refreshTable()">查 询</el-button>
         </div>
      </div>
      <div class="table" v-loading="loading">
      <scroll-pagination @load="refreshTable" :finishLoding="finishLoding">
      <scroll-pagination @load="refreshTable" :finishLoding="finishLoding" :list="list">
        <ul class="card">
        <li v-for="(m,i) in list" :key="i">
          <el-image class="img" :src="javaApi+'/img/'+m.imageUpload">
@@ -218,17 +218,27 @@
        pageSize: 16, // 一页16条
        total: '',
        loading: true, // 组件loading的展示,默认为true
        finishLoding: false // 加载完成,显示已经没有更多了
        finishLoding: false, // 加载完成,显示已经没有更多了
        keyMap: {}
         }
      },
    created() {
      this.selectEnumByCategory()
      this.keyMap = {};
      this.currentPage = 1;
      this.list = [];
      this.refreshTable();
    },
      methods: {
         refreshTable() {
        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
        }
@@ -284,6 +294,7 @@
            })
         },
         refresh() {
        this.keyMap = {};
        this.currentPage= 1;
        this.list=[];
        this.finishLoding = false;