Answer the question
In order to leave comments, you need to log in
[ Vue ] $emit from dynamic component?
We mount the component directly in the DOM:
toogleForm () {
const Tbody = document.querySelector('tbody')
const AddNewRowCtor = Vue.extend(AddNewRow)
const addNewRowCtorInstance = new AddNewRowCtor().$mount()
Tbody.insertBefore(addNewRowCtorInstance.$el, Tbody.querySelector('tr'))
},
emitRow () {
console.log('test')
this.$emit('addResource', {
name: 'Test',
identifier: 'Test'
})
}
Answer the question
In order to leave comments, you need to log in
Where did you sign up for the event?
toogleForm () {
const Tbody = document.querySelector('tbody')
const AddNewRowCtor = Vue.extend(AddNewRow)
const addNewRowCtorInstance = new AddNewRowCtor().$mount()
addNewRowCtorInstance.$on('addResource', payload => { /* wow! */ });
Tbody.insertBefore(addNewRowCtorInstance.$el, Tbody.querySelector('tr'))
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question