//通过接口获取list
handleSearchList = async (url) => {
try {
const res = await url();
if (res.data && res.data.length > 0) {
this.setState({
thirdList: res.data,
showThird: true,
tabName: '',
});
}
} catch (error) {}
};
React开发(272):try...catch..捕获
![](https://img2024.cnblogs.com/blog/35695/202502/35695-20250207193659673-708765730.jpg)