salix-front/src/App.vue

48 lines
957 B
Vue
Raw Normal View History

2022-03-24 14:02:30 +00:00
<script setup>
2022-12-13 11:21:12 +00:00
import { onMounted } from 'vue';
2024-01-09 13:37:44 +00:00
import { useQuasar, Dark } from 'quasar';
import { useI18n } from 'vue-i18n';
2022-03-24 14:02:30 +00:00
const quasar = useQuasar();
const { availableLocales, locale, fallbackLocale } = useI18n();
2024-01-09 13:37:44 +00:00
Dark.set(true);
2022-03-24 14:02:30 +00:00
2022-12-13 11:21:12 +00:00
onMounted(() => {
let userLang = window.navigator.language;
if (userLang.includes('-')) {
userLang = userLang.split('-')[0];
}
if (availableLocales.includes(userLang)) {
locale.value = userLang;
} else {
locale.value = fallbackLocale;
}
});
2022-03-24 14:02:30 +00:00
quasar.iconMapFn = (iconName) => {
if (iconName.startsWith('vn:')) {
const name = iconName.substring(3);
return {
cls: `icon-${name} notranslate`,
2022-03-24 14:02:30 +00:00
};
}
2022-11-29 13:45:48 +00:00
return {
cls: 'material-symbols-outlined notranslate',
2022-11-29 13:45:48 +00:00
content: iconName,
};
2022-03-24 14:02:30 +00:00
};
</script>
2022-03-24 12:33:14 +00:00
<template>
2023-04-11 11:31:03 +00:00
<RouterView />
2022-03-24 12:33:14 +00:00
</template>
2022-03-24 14:02:30 +00:00
<style lang="scss">
.body--light {
background-color: #eee;
}
</style>