Here is my code:
<div id='R'> {{ y.vmx() }} </div>
<script>
class Test {
vmx() {
return vm.x
}
}
var vm = new Vue({
el: '#R',
data: {
x: 11,
y: new Test()
}
})
</script>
This error pops up:
TypeError: Cannot read property 'x' of undefined at Test.vmx ((index):18)
How can I access a Vue variable inside a class method? (Vue v2.6.11)