webview相关页面进入时先等待500毫秒等待cookie写入完成

This commit is contained in:
yezian 2024-01-23 21:52:17 +08:00
parent 73bd6567b8
commit 72f3438956
1 changed files with 13 additions and 2 deletions

View File

@ -5,9 +5,9 @@ import { Toast } from "antd-mobile";
import { generateSignature } from "@/utils/crypto";
import webviewBaseRequest from "@/utils/webviewBaseRequest";
//todo:
export default function BillDetail({ params }) {
const [data, setData] = useState([]);
const [isFetching, setIsFetching] = useState(true);
useEffect(() => {
const getData = async () => {
let type;
@ -58,11 +58,14 @@ export default function BillDetail({ params }) {
return;
}
setData(temData.data.list);
setIsFetching(false);
} catch (error) {
console.error(error);
}
};
getData();
setTimeout(() => {
getData();
}, 500);
}, []);
const RenderItem = ({ item }) => {
@ -82,6 +85,14 @@ export default function BillDetail({ params }) {
);
};
if (isFetching) {
return (
<section className="flex flex-1 justify-center container">
<span className="absolute top-1/2 loading loading-spinner loading-lg"></span>
</section>
);
}
return (
<section className="flex flex-1 flex-col">
{data.length === 0 && (