[Vuejs]-Putting validation on datepicker component of vuejs but its showing up the the error message by default

-2๐Ÿ‘

I have a solution for you.

<div id="app">

  <input type="text" placeholder="type something" v-model.trim="text" @blur="blur">
  <span v-show="text === ''">Please Fill the input</span>

</div>

new Vue({
  el: "#app",
  data: {
    text: null
  },
  methods: {
    blur() {
      if(this.text === null) {
        this.text = ''
      }
    }
  }
})

The answer it is simplified to understand the logic.Once you do,you can solve your problem by replacing some code.Take a look to the demo

Leave a comment