weifeiyue / vue-datepicker

datepicker component for Vue.js
102 stars 24 forks source link

REQUEST: dynamically changing locale #14

Closed yusren closed 6 years ago

yusren commented 6 years ago

First of all, i am still a newbie with vuejs. I'm using this Boilerplate Repo for my project. https://github.com/cretueusebiu/laravel-vue-spa I do not want to use a bootstrap datepicker because it uses jquery. I do not want to use jquery too. With vue-i18n https://github.com/kazupon/vue-i18n module, all controls in the form can be translated dynamically. But not with vue-datepicker. I'm using this "tricky" code.

import lang from '~/store/modules/lang' data: { local: { ... monthsHead: lang.state.locale == 'en' ? 'January_February_March_April_May_June_July_August_September_October_November_December' \ .split('_') : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember' \ .split('_') , ... } }

But but the result appears only after the page refreshes. Is there a way I can change locale without refresh the page? Thanks for your attention.

yusren commented 6 years ago

Sory for my mistake. This Issued this issue should be related to VueJS 2.* So I move it to the right Place