28 lines
645 B
TypeScript
28 lines
645 B
TypeScript
import { PropsWithChildren } from 'react';
|
|
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',
|
|
data: {
|
|
token: 'token_test',
|
|
},
|
|
}).then(res => {
|
|
console.log(res.data);
|
|
pt.setLang(res.data.data.lang);
|
|
});
|
|
});
|
|
|
|
// children 是将要会渲染的页面
|
|
return children;
|
|
}
|
|
|
|
export default App;
|