[Vuejs]-Check length of Object size / BootstrapVue

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>

Leave a comment