1
2
3
4
5
6
7
8
9
10
11
12
13
| import Vue from 'vue';
| Vue.directive('loadmore', {
| bind(el, binding) {
| // 获取element-ui定义好的scroll盒子
| const selectEle = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap');
| selectEle.addEventListener('scroll', function() {
| const condition = this.scrollHeight - this.scrollTop <= this.clientHeight;
| if (condition) {
| binding.value();
| }
| });
| }
| });
|
|