Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
emit event on table listeners
  • Loading branch information
service-paradis authored Mar 17, 2021
1 parent f21b7dc commit 59c3efd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/pages/components/table/api/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ export default [
{
name: '<code>mouseenter</code>',
description: 'Triggers when mouse enters a row',
parameters: '<code> row: Object </code>'
parameters: '<code> row: Object </code>, <code> event: Event </code>'
},
{
name: '<code>mouseleave</code>',
Expand Down
8 changes: 6 additions & 2 deletions src/components/table/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@
}]"
@click="selectRow(row)"
@dblclick="$emit('dblclick', row)"
@mouseenter="$listeners.mouseenter ? $emit('mouseenter', row) : null"
@mouseleave="$listeners.mouseleave ? $emit('mouseleave', row) : null"
@mouseenter="emitEventForRow('mouseenter', $event, row)"
@mouseleave="emitEventForRow('mouseleave', $event, row)"
@contextmenu="$emit('contextmenu', row, $event)"
:draggable="draggable"
@dragstart="handleDragStart($event, row, index)"
Expand Down Expand Up @@ -1315,6 +1315,10 @@ export default {
this.$emit('dragleave', {event, row, index})
},
emitEventForRow(eventName, event, row) {
return this.$listeners[eventName] ? this.$emit(eventName, row, event) : null
},
refreshSlots() {
this.defaultSlots = this.$slots.default || []
}
Expand Down

0 comments on commit 59c3efd

Please sign in to comment.