0π
β
This is the answer.. I need to reference "Number" in my Object.keys than I will get the length.
var size = Object.keys(inputNumber.Number).length;
console.log(size);
0π
I would watch for the reactive data, like this:
<script>
export default {
data () {
return {
number: 0,
message: ""
}
},
watch: {
"number"(){
if (this.number.length == 5) {
this.message = "Do this"
}
else {
this.message = "Do that"
}
}
}
}
</script>
<template>
<input v-model="number">
<div>{{ message }}</div>
</template>
Source:stackexchange.com