Recently I found out that I can't use computed property or a data properties within the components slot. Even though computed is defined in the component, I am not able to use it in the component's slot. Is there any way of getting it work?
Example code:
Vue.component('test-component', {
template: '<div><slot></slot></div>',
computed: {
my_computed: function(){
return 2+3; // not defined in slot
}
}
})
<div id="app">
<test-component>
<span v-text="my_computed"></span>
</test-component>
</div>
See live example here, https://jsfiddle.net/gu9jh4n0/1/