I'm using Vue 3 latest.
Outer template:
<base-table @row-click="routeToEdit" ...>
... slots
</base-table>
Inner BaseTable
component on my tr
div:
<div @click="triggerRowClick(item)">...</div>
In methods of BaseTable
:
methods: {
triggerRowClick(item) {
this.$emit('row-click', { item });
},
},
And back out in my outer template... this
is undefined and I have no access to $router
or anything else :(
methods: {
routeToEdit: ({ item }) => {
// this.$router.push('room_edit', { params: { room_id: item.id } });
console.log(item);
},
},