add internationalization / dynamic themes

This commit is contained in:
landaiqing
2024-08-09 19:51:56 +08:00
parent c13613ec07
commit 438965f2a2
28 changed files with 402 additions and 391 deletions

View File

@@ -1,20 +1,36 @@
<template>
<AButton> alvoa</AButton>
<div>
<AButton @click="handleClick"> {{ t('login.test') }}</AButton>
<AButton @click="changeLang('zh')"> 切换中文</AButton>
<AButton @click="changeLang('en')"> 切换英文</AButton>
<ADatePicker/>
<ATimePicker/>
{{ data }}
</div>
</template>
<script setup lang="ts">
// import {getUserInfo} from "@/api/user";
// import {useRequest} from "alova/client";
//
// const {loading, data, send} = useRequest(getUserInfo, {
// immediate: true,
// throttle: 3000,
// });
// const handleClick = () => {
// send();
// console.log(loading.value);
// console.log(data.value);
//
// };
import {useRequest} from "alova/client";
import {getUserInfo} from "@/api/user";
import {useI18n} from "vue-i18n";
import useStore from "@/store";
const {t, locale} = useI18n();
const {data, send} = useRequest(getUserInfo, {
immediate: false
});
const handleClick = () => {
send();
};
const lang = useStore().lang;
async function changeLang(language: any) {
lang.setLang(language);
locale.value = language;
}
</script>
<style src="./index.scss" scoped>
</style>