123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- // import { Component, PropsWithChildren } from 'react'
- import './app.scss'
- // class App extends Component<PropsWithChildren> {
- // componentDidMount () {}
- // componentDidShow () {}
- // componentDidHide () {}
- // render () {
- // // this.props.children 是将要会渲染的页面
- // return this.props.children
- // }
- // }
- // export default App
- import { PropsWithChildren } from 'react';
- import { useRequest } from 'ahooks';
- import Taro from '@tarojs/taro';
- import AppContext from './context/appContext';
- import { Provider as ReduxProvider } from 'react-redux';
- import ReduxUtil from './utils/reduxUtil';
- import UserHelper from './helper/userHelper';
- interface IAppProps {
- }
- const App = (props: PropsWithChildren<IAppProps>) => {
- const result = useRequest(Taro.getSystemInfo);
- useRequest(() => {
- return UserHelper.cacheTabMenu();
- })
- return (
- // (appContext.systemInfo?.screenHeight || 0) - (appContext.systemInfo?.safeArea?.bottom || 0);
- <AppContext.Provider value={{
- systemInfo: result.data,
- screenSize: {
- width: result.data?.screenWidth || 0,
- height: result.data?.screenHeight || 0,
- },
- padding: {
- top: result.data?.safeArea?.top || 0,
- bottom: (result.data?.screenHeight || 0) - (result.data?.safeArea?.bottom || 0),
- }
- }} >
- <ReduxProvider store={ReduxUtil.store} >
- {props.children}
- </ReduxProvider>
- </AppContext.Provider>
- )
- }
- export default App;
|