import { Toast, Portal } from "@ant-design/react-native"; // 加载页 export default { state: { status: "loading", title: "成功", show: false, time: -1, tKey: "", }, actions: ({ model, setState }) => ({ loading() { const { tKey } = model(); if (!tKey) { const newKey = Toast.loading("Loading...", 0); setState({ tKey: newKey, }); } }, success(title) { const { clearLoading } = model(); clearLoading(); Toast.success(title, 2); }, warnning(title) { const { clearLoading } = model(); clearLoading(); Toast.info(title, 2); }, clearLoading() { const { tKey } = model(); if (tKey) { Portal.remove(tKey); setState({ tKey: "", }); } }, }), };