TS_0001:杂记:一些写法 同步加载数据
1,TS同步加载数据
onMounted(async () => { const { data }: any = await getMapExtScript({ page: 1, page_size: 50 }); if (data && data.list) { scriptData.value = data.list; pagination.value.total = data.total; allData = data.list; } // 拼接地图 if (mapDrawingStore.mapByDblclick && mapDrawingStore.mapByDblclick.identity) { const { data: extData }: any = await getMapTreeExtData(mapDrawingStore.mapByDblclick.identity); if (extData && extData['elevators_group']) { const elevatorsGroup = extData['elevators_group']; mapDrawingStore.$patch((state) => { state.elevatorGroup = elevatorsGroup.elevator; }); } } mapDrawingStore.$patch({ elevatorId: mapDrawingStore.elevatorGroup[0].id }); });
2,
琥珀君的博客