I defined my Vue scope in the main.js file like this:
new Vue({
el: '#app',
router,
template: '<App/>',
components: { App },
data: {
name: 'Levi'
}
})
Now, I want to access it in my template file named test.vue
:
<p>My name is {{ name }}
Although vue-router is working fine for routing, I encountered an issue when trying to display name
in my template. It resulted in the following warning message:
[Vue warn]: Property or method "name" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.
If anyone can provide guidance on how to resolve this, I would greatly appreciate it. Thank you.