dwqs / v2-datepicker

A simple datepicker component based Vue 2.x: https://dwqs.github.io/v2-datepicker/
MIT License
89 stars 21 forks source link

Lang change is not reactive #19

Closed nelson6e65 closed 6 years ago

nelson6e65 commented 6 years ago

I used a data variable for the current locale. I try to bind with lang prop of <v2-datepicker>, but I must reload the page to apply the datepick lang change.

<v2-datepicker v-else :lang="locale"></v2-datepicker>
dwqs commented 6 years ago

I will check it

nelson6e65 commented 6 years ago

Also, other props in the picker panel are not reactive (like default date or current date if I set from javascript instead of clicking).

I think is because this info is only changed when initialized, and do not changes (L144 for lang, for example):

https://github.com/dwqs/v2-datepicker/blob/65eeca6b38c0da5e13700dfb0d52272675e7a80e/components/date-picker/index.vue#L139-L151

Maybe some actions in the content of this conditional should be handled separately. Or move initialization to the mounted() method and remove the conditional.

dwqs commented 6 years ago

Yes, some prop of the component only changed when initialized. Maybe should add some methods to listen to the prop changed.

dwqs commented 6 years ago

fix it in v3.1.0: https://github.com/dwqs/v2-datepicker/releases/tag/v3.1.0