I am new to Vuejs, so I apologize if this is a beginner question.
I have added a router to my App and I want to display data from my main App in my Components templates, but it doesn't seem to be working.
Here is my current setup:
Vue.use(VueRouter);
const Text = { props: ['text'], template: '<div>This is the text: {{text}} </div>' }
const routes = [
{ path: '*', component: Text, props: true }
]
const router = new VueRouter({
routes: routes
})
new Vue({
router: router,
el: "#app",
data: {
text: "Hello there!"
}
})
I expected the text
prop to be linked to my App.data.text
, but it is not working as expected.
Here is the jsfiddle link for reference: https://jsfiddle.net/fguillen/psqztn93