| | |
| | | <div class="scroll-pagination" ref="content" @scroll="onScroll"> |
| | | <slot></slot> |
| | | <el-button |
| | | v-if="isLoding" |
| | | v-show="isLoding" |
| | | type="text" |
| | | style="display: flex; margin: 0 auto; color: #909399" |
| | | ><i class="el-icon-loading" style="font-size:20px"></i |
| | | ></el-button> |
| | | <el-button |
| | | type="text" |
| | | v-if="finishLoding" |
| | | v-show="finishLoding" |
| | | style="display: flex; margin: 0 auto; color: #909399" |
| | | >已经没有更多啦~</el-button |
| | | > |
| | |
| | | finishLoding: { |
| | | type:Boolean, |
| | | default:false |
| | | }, |
| | | list:{ |
| | | type:Array, |
| | | default:()=>[] |
| | | } |
| | | }, |
| | | watch: { |
| | | list:{ |
| | | deep:true, |
| | | handler(){ |
| | | this.isLoding = false |
| | | } |
| | | } |
| | | }, |
| | | data() { |
| | |
| | | }, |
| | | created(){ |
| | | // 防抖 |
| | | this.onScroll = this.debounce(this.scrollFn,2000); |
| | | this.onScroll = this.debounce(this.scrollFn,500); |
| | | // 节流 |
| | | // this.onScroll = this.throttle(this.scrollFn,1000); |
| | | }, |
| | |
| | | this.isLoding = true |
| | | setTimeout(() => { |
| | | this.$emit('load') |
| | | this.isLoding = false |
| | | }, 1000) |
| | | }, 500) |
| | | }, |
| | | debounce(func, delay) { |
| | | let timer = null; |