perf: use util in OutLayout
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
21251a5167
commit
00cea34dde
|
@ -1,6 +1,9 @@
|
|||
<script setup>
|
||||
import quasarLang from 'src/utils/quasarLang';
|
||||
|
||||
import { onMounted, computed, ref } from 'vue';
|
||||
import { Dark, Quasar } from 'quasar';
|
||||
|
||||
import { Dark } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
|
@ -22,7 +25,6 @@ const { t, locale } = useI18n();
|
|||
const { copyText } = useClipboard();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const langList = import.meta.glob('../../node_modules/quasar/lang/*.js');
|
||||
const userLocale = computed({
|
||||
get() {
|
||||
return locale.value;
|
||||
|
@ -32,13 +34,7 @@ const userLocale = computed({
|
|||
|
||||
value = localeEquivalence[value] ?? value;
|
||||
|
||||
try {
|
||||
langList[`../../node_modules/quasar/lang/${value}.js`]().then((lang) => {
|
||||
Quasar.lang.set(lang.default);
|
||||
});
|
||||
} catch (error) {
|
||||
//
|
||||
}
|
||||
quasarLang(value);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
import { Dark, Quasar } from 'quasar';
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { localeEquivalence } from 'src/i18n/index';
|
||||
import quasarLang from 'src/utils/quasarLang';
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
|
||||
|
@ -12,18 +14,9 @@ const userLocale = computed({
|
|||
set(value) {
|
||||
locale.value = value;
|
||||
|
||||
if (value === 'en') value = 'en-GB';
|
||||
value = localeEquivalence[value] ?? value;
|
||||
|
||||
// FIXME: Dynamic imports from absolute paths are not compatible with vite:
|
||||
// https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations
|
||||
try {
|
||||
const langList = import.meta.glob('../../node_modules/quasar/lang/*.mjs');
|
||||
langList[`../../node_modules/quasar/lang/${value}.mjs`]().then((lang) => {
|
||||
Quasar.lang.set(lang.default);
|
||||
});
|
||||
} catch (error) {
|
||||
//
|
||||
}
|
||||
quasarLang(value);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
const langList = import.meta.glob('../../node_modules/quasar/lang/*.js');
|
||||
import { Quasar } from 'quasar';
|
||||
|
||||
export default function (value) {
|
||||
try {
|
||||
langList[`../../node_modules/quasar/lang/${value}.js`]().then((lang) => {
|
||||
Quasar.lang.set(lang.default);
|
||||
});
|
||||
} catch (error) {
|
||||
//
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue