change Table event @on-cell-click position
This commit is contained in:
parent
9d6b5f0381
commit
03e6c07622
2 changed files with 16 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div :class="classes" ref="cell" @click="handleCellClick">
|
||||
<div :class="classes" ref="cell">
|
||||
<template v-if="renderType === 'index'"><span>{{ column.indexMethod ? column.indexMethod(row) : (naturalIndex + 1) }}</span></template>
|
||||
<template v-if="renderType === 'selection'">
|
||||
<Checkbox :value="checked" @click.native.stop="handleClick" @on-change="toggleSelect" :disabled="disabled"></Checkbox>
|
||||
|
@ -162,9 +162,10 @@
|
|||
handleToggleTree () {
|
||||
this.$parent.$parent.$parent.toggleTree(this.row._rowKey);
|
||||
},
|
||||
handleCellClick (event) {
|
||||
this.$parent.$parent.$parent.$emit('on-cell-click', this.row, this.column, this.row[this.column.key], event);
|
||||
}
|
||||
// 改为 table-body 中触发,因为 cell 有padding间距
|
||||
// handleCellClick (event) {
|
||||
// this.$parent.$parent.$parent.$emit('on-cell-click', this.row, this.column, this.row[this.column.key], event);
|
||||
// }
|
||||
},
|
||||
created () {
|
||||
if (this.column.type === 'index') {
|
||||
|
|
|
@ -114,6 +114,9 @@
|
|||
event.stopPropagation();
|
||||
this.$parent.dblclickCurrentRow(_index, rowKey);
|
||||
},
|
||||
clickCell (row, column, key, event) {
|
||||
this.$parent.$emit('on-cell-click', row, column, row[key], event);
|
||||
},
|
||||
contextmenuCurrentRow (_index, event, rowKey) {
|
||||
event.stopPropagation();
|
||||
if (this.$parent.contextMenu) event.preventDefault();
|
||||
|
@ -257,7 +260,10 @@
|
|||
|
||||
const $td = h('td', {
|
||||
class: this.alignCls(column, row),
|
||||
attrs: this.getSpan(row, column, index, colIndex)
|
||||
attrs: this.getSpan(row, column, index, colIndex),
|
||||
on: {
|
||||
click: (e) => this.clickCell(row, column, column.key, e)
|
||||
}
|
||||
}, [$tableCell]);
|
||||
$tds.push($td);
|
||||
}
|
||||
|
@ -333,7 +339,10 @@
|
|||
|
||||
const $td = h('td', {
|
||||
class: this.alignCls(column, row),
|
||||
attrs: this.getSpan(row, column, index, colIndex)
|
||||
attrs: this.getSpan(row, column, index, colIndex),
|
||||
on: {
|
||||
click: (e) => this.clickCell(row, column, column.key, e)
|
||||
}
|
||||
}, [$tableCell]);
|
||||
$tds.push($td);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue