<template>
  <div>
    <el-table 
    :data="logList"
    :show-header="false"
    row-class-name="table-row-class"
    max-height="700"
    ref="table"
    @row-click="rowClick">
      <el-table-column
      label="log信息"
      prop="message">
    </el-table-column>
      <el-table-column
      label="log信息"
      prop="message">
    </el-table-column>
    </el-table>
  </div>

</template>

<script>
  export default {
    data(){
      return {
        logList :[
          { id: 1,message:'张三' },
          { id: 2,message:'张三' },
          { id: 3,message:'张三' },
          { id: 4,message:'张三' },
          { id: 5,message:'张三' },
       
        ]
      }
    },
    mounted() {
      // 获取需要绑定的table
      this.dom = this.$refs.table.bodyWrapper
      this.dom.addEventListener('scroll', () => {
        console.log("this.$refs.table.bodyWrapper",this.$refs.table)
        // 滚动距离
        let scrollTop = this.dom.scrollTop
        // 变量windowHeight是可视区的高度
        let windowHeight = this.dom.clientHeight || this.dom.clientHeight
        // 变量scrollHeight是滚动条的总高度
        let scrollHeight = this.dom.scrollHeight || this.dom.scrollHeight
        if (scrollTop + windowHeight === scrollHeight) {
        // 获取到的不是全部数据 当滚动到底部 继续获取新的数据
        if (!this.allData) this.getMoreLog()
        console.log('scrollTop', scrollTop + 'windowHeight', windowHeight + 'scrollHeight', scrollHeight)
        }
      })
    },
    methods :{ 
      rowClick() {

      },
      getMoreLog() {
        this.dom.scrollTop = this.dom.scrollTop - 100
      }
    }
  }
</script>
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45 7 个月前
a07f3a59 * Update transition.md * Update table.md * Update transition.md * Update table.md * Update transition.md * Update table.md * Update table.md * Update transition.md * Update popover.md 7 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐