系列
element系列 - input 改造
element系列 - select 改造
element系列 - form 改造
element系列 - tree 改造
element系列 - pagination 改造
需求
- 引入lodash,给 pagination 加防抖
github项目地址
代码
import Vue from "vue";
import { debounce } from "lodash";
import { Pagination } from "element-ui";
const elPaginationHack = {
install: (Vue) => {
const onPagerClick = Pagination.components.Pager.methods.onPagerClick;
Object.assign(Pagination.components.Pager.methods, {
onPagerClick: debounce(
function (...args) {
onPagerClick.apply(this, args);
},
300,
{
leading: true,
trailing: false,
}
),
});
Vue.use(Pagination);
},
};
Vue.use(elPaginationHack);