import { Toast } from 'antd-mobile'
// 渲染覆盖物入口
async renderOverlays(id) {
try {
// 开启loading
Toast.loading('加载中...', 0, null, false)
const res = await axios.get(`http://localhost:8080/area/map?id=${id}`);
// 关闭loading
Toast.hide()
const data = res.data.body;
// 获取 覆盖物的 类型和缩放级别
const { nextZoom, type } = this.getTypeAndZoom();
data.forEach((item) => {
// 创建覆盖物
this.createOverlays(item, nextZoom, type);
});
} catch (e) {
// 关闭loading
Toast.hide()
}
}
react项目中加loading效果
最新推荐文章于 2025-04-09 09:19:33 发布