How can I add button click for call a method if I click icon next month in the datepicker on vuetify?

天涯浪子 提交于 2019-12-11 10:55:23

问题


I want to ask. How can I add button click for call a method if I click icon next month in the datepicker?

Look at this :

How can I do it?

Update :

I using vuetify : https://vuetifyjs.com/en/components/date-pickers#date-pickers-allowed-dates


回答1:


Probably you're looking for something like this:

https://vuetifyjs.com/en/components/date-pickers#date-pickers-react-to-displayed-month-year-change

Basically you should use the picker-date.sync prop and watch for its changes using a watcher.

<v-date-picker v-model="date" :picker-date.sync="pickerDate"/>
export default {
  data() {
    return {
      date: new Date().toISOString().substr(0, 10),
      pickerDate: null,
    }
  ),
  watch: {
    pickerDate (newval,oldval) {
      // here you can check if month changed using newval and oldval
    },
  },
}



回答2:


You can try this

   $(document).on('click', '.ui-datepicker-next', function () {
     console.log('next');  
    })

    $(document).on('click', '.ui-datepicker-prev', function () {
      console.log('prev');  
    })


来源:https://stackoverflow.com/questions/58374477/how-can-i-add-button-click-for-call-a-method-if-i-click-icon-next-month-in-the-d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!