-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Description
Vue.js version
2.1.3
Reproduction Link
https://jsfiddle.net/x8a3vvk2/8/
Events emitted from component inside slot are not received.
$emit('testevent') is not working but $parent.test() works.
<script src="https://unpkg.com/vue@2.1.3/dist/vue.js"></script>
<div id="app" >
<parent>
<child></child>
</parent>
</div>
Vue.component('parent', {
template: `<div><slot @testevent="test"></slot></div>`,
methods: {
test () {
alert('Test ok')
}
}
})
Vue.component('child', {
template: `<button @click="$emit('testevent')">I'm slot</button>`
//template: `<button @click="$parent.test()">I'm slot</button>`
})
new Vue({
el: '#app',
})
michaelhays, neel, averri, jorostoyanov, tomderudder and 16 more
Metadata
Metadata
Assignees
Labels
No labels