useLang.hook.js 287 B

1234567891011121314151617
  1. import { computed } from 'vue'
  2. import { useLangStore } from '@/stores/modules/langStore'
  3. // 语言切换
  4. export const useLang = () => {
  5. const lang = useLangStore()
  6. console.log(lang)
  7. const locale = computed(() => {
  8. return i18n[lang.getLang]
  9. })
  10. return {
  11. locale
  12. }
  13. }