Reputation: 1166
I have two Vues - Test1 and Test2. From Test1, I am calling Test2 as a new Vue instance. I need to pass a value, am trying to do that using props and data but obviously making some mistake. Below is the code snippet -
import Test2 from '@/components/Test2.vue';
new Vue({
el: '#app',
components: { Test2 },
props: { varpassedprops: 'TESTINGPROPS'},
data() {
return {
varpassed: 'TESTING'
}
},
template: '<Test2/>',
render: h => h(Test2)
});
export default {
props: 'varpassedprops',
data() {
return {
varpassed: ""
}
},
In Test2, if I try to use either attribute, I get empty (""). Please let me know what I might be doing wrong, appreciate your help.
Upvotes: 0
Views: 102
Reputation: 408
I havent worked with render()
to much but believe you pass them like this
render: h => h(Test2, {
props: {
varpassed: this.varpassed
})
});
Upvotes: 1