Vue2-datepicker: How do I open picker v.3.6.2 with custom button?

Created on 17 Sep 2020  路  7Comments  路  Source: mengxiong10/vue2-datepicker

Hi! I cant find any way to open date picker on button? And to hide input.

All 7 comments

use prop open.

    <date-picker
      v-model="value"
      :open="open"  ></date-picker>
    <button @click="toggle">toggle</button>
data() {
  return {
    open: false
  }
},
methods: {
   toggle () {
      this.open = !this.open
  }
}

Doesn't work with inline prop https://codepen.io/OlegF/pen/XWdPrjb

You can use v-show when use inline.

If you use v-show, the calendar position floats left top :(

You can use style={ opacity: open ? '1' :'0'}

Thank! You have a great vue kung fu.

Hi :) I just wanted to add that if you want to hide the input field, it is probably better to use visibility: hidden instead of opacity: 0. If you use opacity: 0 the mouse cursor will still change when you hover over the space where the input field would normally be. If you use visibility: hidden instead, it does not. Great date picker by the way, thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

musman92 picture musman92  路  4Comments

kugatsu765 picture kugatsu765  路  3Comments

georgehrke picture georgehrke  路  4Comments

camper2020 picture camper2020  路  3Comments

DragosPeta picture DragosPeta  路  3Comments