UNPKG

cxs-ui

Version:

Vue 动态表格组件和动态表单组件

70 lines (68 loc) 1.54 kB
export default { /** * 查看 * @param row */ handleView(row) { this.$emit('viewClick', row) }, /** * 编辑 * @param row */ handleEdit(row) { this.$emit('editClick', row) }, /** * 删除 * @param row */ handleDelete(row) { this.$emit('deleteClick', row.id) }, /** * 表格选择项发生变化 * @param rows */ selectionChange(rows) { this.$emit('selectionChange', rows) }, /** * 点击查询按钮 */ searchHandler() { this.$emit('handleSearch', this.searchData) }, /** * 重置按钮 */ resetHandler() { this.searchData = {}; }, handleSizeChange(v) { this.pageOption['size'] = v if (this.pageOption['size'] > this.pageOption['total']) { this.pageOption['current'] = 1; } this.debounce(this.pagerChange, 500) }, handleCurrentChange(v) { this.pageOption['current'] = v this.debounce(this.pagerChange, 500) }, pagerChange() { this.$emit('pagerChange', this.pageOption) }, /** * 防抖函数: delay时间内只回调一次callback * @param callback * @param delay */ debounce: function (callback, delay) { if (timer == 1) return; setTimeout(() => timer = null, delay) timer = 1; callback(); } } let timer = null;