Vue 2 repro template
Template to provide a repro for a Vue 2 issue
by Tim McKay
HTML
<script src="https://unpkg.com/vue"></script>
<div id="app">
<parent>
<h2 slot-scope="{ number }">{{ number }}</h2>
</parent>
</div>
<template slot-scope="scope">
</template>
JavaScript
Vue.component('Child', {
data: () => ({ random: Math.random() }),
template: `
<div>
<p>in child</p>
<slot :number="random"></slot>
</div>
`
})
Vue.component('Parent', {
render (h) {
return h('div', [
h('p', 'Parent'),
h('child', {
scopedSlots: this.$scopedSlots
})
])
}
})
new Vue({
el: '#app',
data: {
numbers: [1, 2, 3]
}
})