add locale request

This commit is contained in:
Dawn_Ocean
2024-03-08 21:24:08 +08:00
parent 1907f1e967
commit 00977db512
5 changed files with 36045 additions and 36024 deletions
+10 -1
View File
@@ -1,11 +1,20 @@
import { PropsWithChildren } from 'react';
import { useLaunch } from '@tarojs/taro';
import Taro, { useLaunch } from '@tarojs/taro';
import { getUrl } from '@/service';
import pt from '@/plain-text';
import 'taro-ui/dist/style/index.scss';
import './app.scss';
function App({ children }: PropsWithChildren<any>) {
useLaunch(() => {
console.log('App launched.');
Taro.request({
url: getUrl('/user/locale/get'),
method: 'GET',
}).then(res => {
console.log(res.data);
pt.setLang(res.data.data.lang);
});
});
// children 是将要会渲染的页面