3π
β
-
First, defined an EventBus if you donβt have
EventBus.vue
import Vue from 'vue'
export default new Vue()
-
In ListPayment.vue, import
EventBus
and listen forrefresh-table
event. Note that I addref="table"
to vue-tables-2 element<template> <v-server-table ref="table" ... /> </template> <script> import EventBus from './EventBus.vue' export default { mounted() { EventBus.$on('refresh-table', this.refreshTable) }, beforeDestroy() { EventBus.$off('refresh-table', this.refreshTable) }, methods: { refreshTable() { this.$refs.table.refresh(); } } } </script>
-
Finally, emit event in modal
pay() {
service.pay(this.data)
.then(() => {
EventBus.$emit('refresh-table')
})
.then(this.hide());
}
π€ittus
Source:stackexchange.com