icai / vue3-calendar

vue 2.x vue 3.x calendar component
https://icai.github.io/vue3-calendar/
MIT License
494 stars 89 forks source link

v-model didn't work #19

Closed aianzi closed 6 years ago

aianzi commented 7 years ago

when I use this component, I can just change the data-inputValue instead of props-value. Then I got data of ''. So could you explain how to get the value? thanks a lot

rodrigocachoeira commented 7 years ago

You will need to change Calendar.vue of component itself, just add a watch function for inputValue, and add this.$emit('input', value), v-model should me work

kennedyps4 commented 7 years ago

example please

rodrigocachoeira commented 6 years ago

In Calendar.vue

watch: { currDate () { this.getDateRange() } },

add inputValue watcher

watch: { currDate () { this.getDateRange() }, inputValue (value) { this.$emit('input', value) } },

icai commented 6 years ago

based on vue 2.2.0+ https://vuejs.org/v2/guide/components.html#Customizing-Component-v-model

icai commented 6 years ago

updated cf830726ab858990686564ca9c0dd2ec68189729