feat: 告警信息loading
This commit is contained in:
parent
a1611a971a
commit
7f09acbb44
@ -26,8 +26,12 @@
|
||||
</div>
|
||||
</CardItem>
|
||||
|
||||
<div v-if="loading" class="loading-wrapper">
|
||||
<van-loading size="24px" vertical>加载中...</van-loading>
|
||||
</div>
|
||||
|
||||
<!-- 空状态提示 -->
|
||||
<EmptyBox v-if="list.length === 0" placeholder="暂无相关预警信息" />
|
||||
<EmptyBox v-if="!loading && list.length === 0" placeholder="暂无相关预警信息" />
|
||||
</div>
|
||||
</PageContainer>
|
||||
</template>
|
||||
@ -60,15 +64,18 @@ const handleSearch = value => {
|
||||
|
||||
// 预警列表数据
|
||||
const list = ref([]);
|
||||
const loading = ref(false);
|
||||
|
||||
const getData = async (keyword = '') => {
|
||||
const normalizedKeyword = keyword.trim();
|
||||
loading.value = true;
|
||||
|
||||
if (route.query.mock) {
|
||||
list.value = warningMessageMock.filter(item => {
|
||||
if (!normalizedKeyword) return true;
|
||||
return item.title.includes(normalizedKeyword);
|
||||
});
|
||||
loading.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,10 +88,12 @@ const getData = async (keyword = '') => {
|
||||
keyword: normalizedKeyword,
|
||||
},
|
||||
});
|
||||
list.value = result.data.records;
|
||||
list.value = result.data;
|
||||
} catch (_error) {
|
||||
showToast('获取数据失败,请稍后重试');
|
||||
list.value = [];
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
@ -126,6 +135,12 @@ const handleClickBack = () => {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.loading-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 24px 0;
|
||||
}
|
||||
|
||||
/* ==================== Block 层级 ==================== */
|
||||
.time-block {
|
||||
display: flex;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user