taro react编写微信小程序 在pages/airportList/airportList.tsx中使用 useState, async函数时所有页面全部空白,只有标题和底部tab栏,没有任何报错信息。
airportList.tsx
```typescript
import './airportList.less';
import { useState, useEffect } from 'react';
import { View, Text } from '@tarojs/components';
import { useLoad } from '@tarojs/taro';
export default function AirpostList() {
// const [list, setList] = useState([]);
// const getAirpostList = async () => {
// }
// useEffect(() => {
// getAirpostList();
// return () => {
// }
// }, []);
useLoad(() => {
console.log('Page loaded.');
});
return (
<View className='index'>
<Text>Hello world!</Text>
</View>
);
}
app.config.ts
export default defineAppConfig({
pages: [
'pages/index/index',
'pages/order/order',
'pages/airportList/airportList'
],
window: {
backgroundColor: '#eeeeee',
backgroundTextStyle: 'light',
navigationBarTitleText: '远方',
navigationBarTextStyle: 'white',
navigationBarBackgroundColor: '#ffffff',
},
tabBar: {
color: '#7F8389',
selectedColor: '#5495E6',
backgroundColor: '#ffffff',
borderStyle: 'black',
position: 'bottom',
list: [
{
pagePath: 'pages/index/index',
text: '首页',
iconPath: 'assets/images/index-unselected.png',
selectedIconPath: 'assets/images/index-selected.png'
},
{
pagePath: 'pages/order/order',
text: '我的订单',
iconPath: 'assets/images/order-unselected.png',
selectedIconPath: 'assets/images/order-selected.png'
}
]
}
});
```