Disclaimer: I know that there is data biding in Vue.js.
So I have this:
<html>
<body>
<div id="app">
<input @input="update">
</div>
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script type="text/javascript">
new Vue({
el: '#app',
data: {
info: '',
},
methods: {
update: function (event) {
value = event.target.value;
this.info = value;
console.log(value);
}
}
});
</script>
</body>
</html>
An input that will trigger a method called update every time the user type in something. The idea here is to change the value of the data property called info with the value typed in the input by the user.
But, for some reason, the value of the data attribute doesn't change. The current input value is printed normally in the console with the console.log(value) call every time the update method is fired, but nothing changes to the info attribute.
So, how to make this work?