Created
March 24, 2020 04:44
-
-
Save hoangtuan151/4dcf22eb78537508c3996d5bff26f2cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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