Add an event when the button is clicked from the parent component

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
utchoang 2020-09-25 21:11:33 +07:00 committed by Rohit Yadav
parent fea280e98f
commit ef8d5ce19c
2 changed files with 11 additions and 2 deletions

View File

@ -405,6 +405,10 @@ export default {
eventBus.$on('async-job-complete', () => {
this.fetchData()
})
eventBus.$on('exec-action', (action, isGroupAction) => {
console.log(action, isGroupAction)
this.execAction(action, isGroupAction)
})
},
mounted () {
if (this.device === 'desktop') {

View File

@ -25,7 +25,8 @@
:actions="actions"
:selectedRowKeys="selectedRowKeys"
:dataView="true"
:resource="resource"/>
:resource="resource"
@exec-action="(action) => execAction(action, action.groupAction && !dataView)" />
</div>
<div slot="resource">
<resource-view
@ -40,10 +41,11 @@
<script>
import { api } from '@api'
import { mixinDevice } from '@/utils/mixin.js'
import eventBus from '@/config/eventBus'
import AutogenView from '@/views/AutogenView.vue'
import ResourceView from '@/components/view/ResourceView'
import ActionButton from '@/components/view/ActionButton'
import { mixinDevice } from '@/utils/mixin.js'
export default {
name: 'PublicIpResource',
@ -158,6 +160,9 @@ export default {
},
toggleLoading () {
this.loading = !this.loading
},
execAction (action, isGroupAction) {
eventBus.$emit('exec-action', action, isGroupAction)
}
}
}