10
rated 0 times
[
11]
[
1]
/ answers: 1 / hits: 17257
/ 7 Years ago, fri, march 17, 2017, 12:00:00
I'm using Vue.js and when I try to access a variable from data inside a computed property, it returns undefined
.
Here's the code:
<script>
export default {
name: 'app',
data: () => {
return {
lang: 'sp'
}
},
computed: {
langEn: () => this.lang === 'en',
langSp: () => this.lang === 'sp'
}
}
</script>
This is in a NPM project. And inside a .vue
file. Maybe it behaves differently when used like this?
Thanks for the help
More From » node.js