As a newcomer to Vue, I've been experimenting with it before diving into our project, but I've encountered a problem.
Typically, when we create an instance like "var app = new Vue ... etc.," we can access its data using app.data. But how do we access data in components like this:
<template>
<div id="app">
Hello {{msg}}
</div>
</template>
<script>
export default {
name: "App",
data() {
return {
msg: "World"
}
}
}
console.log(this.msg)
</script>
I'm struggling to access the msg property―I've tried this.msg, but it's not working. I prefer not to use Vuex for now, as I believe it may be too complex for a small, simple app.
How can I access it?