useLang.hook.js 524 B

1234567891011121314151617181920212223242526
  1. import { computed } from 'vue'
  2. import { useLangStore } from '@/store/modules/langStore'
  3. import zhCN from '@arco-design/web-vue/es/locale/lang/zh-cn';
  4. import enUS from '@arco-design/web-vue/es/locale/lang/en-us';
  5. import thTH from '@arco-design/web-vue/es/locale/lang/th-th';
  6. const i18n = {
  7. "zh-CN": zhCN,
  8. "en-US": enUS,
  9. "th-TH": thTH,
  10. }
  11. // 语言切换
  12. export const useLang = () => {
  13. const lang = useLangStore()
  14. const locale = computed(() => {
  15. return i18n[lang.getLang]
  16. })
  17. return {
  18. locale
  19. }
  20. }