Skip to content

Instantly share code, notes, and snippets.

@hoangtuan151
Created March 24, 2020 04:44
Show Gist options
  • Save hoangtuan151/4dcf22eb78537508c3996d5bff26f2cb to your computer and use it in GitHub Desktop.
Save hoangtuan151/4dcf22eb78537508c3996d5bff26f2cb to your computer and use it in GitHub Desktop.
import i18n from '@/locale/i18n'
import {mapState} from 'vuex'
export var localeMixin = {
computed: {
...mapState(['app_locale'])
},
watch: {
app_locale (newValue) {
this.$i18n.locale = newValue
i18n.locale = newValue
}
},
created: function () {
this.$i18n.locale = this.app_locale
i18n.locale = this.app_locale
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment