diff --git a/src/component/common/InformationBox.vue b/src/component/common/InformationBox.vue
index 9eee1ff..28f4a37 100644
--- a/src/component/common/InformationBox.vue
+++ b/src/component/common/InformationBox.vue
@@ -16,7 +16,11 @@
-
+
| {{ tableData.title }} |
{{ tableData.content }} |
@@ -33,7 +37,7 @@
title: string;
data: Record;
field: Record;
- color: Record | null;
+ style?: Record>;
offsetX: number;
offsetY: number;
}>();
@@ -44,7 +48,8 @@
const newOffsetX = ref(props.offsetX);
const newOffsetY = ref(props.offsetY);
- const tableDatas: Ref<{ title: string; content: string }[]> = ref([]);
+ const tableDatas: Ref<{ title: string; content: string; styles?: Record }[]> =
+ ref([]);
onMounted(() => {
// 判断是否超出屏幕,超出就重新定位
@@ -59,10 +64,14 @@
Object.entries(props.data).forEach(([key, value]) => {
// 判断key是不是存在field中,存在就添加到表格数据,不存在则不添加
if (Object.hasOwn(props.field, key) && value) {
- tableDatas.value.push({
+ const rowData: { title: string; content: string; styles?: Record } = {
title: props.field[key],
content: value,
- });
+ };
+ if (props.style && Object.hasOwn(props.style, key)) {
+ rowData.styles = props.style[key];
+ }
+ tableDatas.value.push(rowData);
}
});
});
diff --git a/src/component/rain-earthquake/basic/CollapseComponent.vue b/src/component/rain-earthquake/basic/CollapseComponent.vue
index 63b3a50..95b205a 100644
--- a/src/component/rain-earthquake/basic/CollapseComponent.vue
+++ b/src/component/rain-earthquake/basic/CollapseComponent.vue
@@ -15,7 +15,7 @@
();
// 获取钩子函数
- const { informationBoxTitle, field, color, getDisasterIcon } = useRiskPoint();
+ const { informationBoxTitle, field, style, getDisasterIcon } = useRiskPoint();
$api.riskSpots.getBasePoints().then((res) => {
riskPoints.value = res.data;
diff --git a/src/component/rain-earthquake/basic/WaterLoggingComponent.vue b/src/component/rain-earthquake/basic/WaterLoggingComponent.vue
index 6d0ce71..c6f0874 100644
--- a/src/component/rain-earthquake/basic/WaterLoggingComponent.vue
+++ b/src/component/rain-earthquake/basic/WaterLoggingComponent.vue
@@ -15,7 +15,7 @@
{
};
/**
- * 颜色
+ * 样式
*/
- const color = {
- probability: 'red',
+ const style = {
+ probability: { background: '#888888' },
};
/**
@@ -59,5 +59,5 @@ export const useHiddenPoint = () => {
}
}
- return { field, color, getDisasterIcon };
+ return { field, style, getDisasterIcon };
};
diff --git a/src/hooks/rain-earthquake/useRiskPoint.ts b/src/hooks/rain-earthquake/useRiskPoint.ts
index 4aac6b2..63aca20 100644
--- a/src/hooks/rain-earthquake/useRiskPoint.ts
+++ b/src/hooks/rain-earthquake/useRiskPoint.ts
@@ -29,10 +29,10 @@ export const useRiskPoint = () => {
};
/**
- * 颜色
+ * 样式
*/
- const color = {
- probability: 'red',
+ const style = {
+ probability: { background: '#888888' },
};
/**
@@ -43,5 +43,5 @@ export const useRiskPoint = () => {
return riskAreaIcon;
}
- return { informationBoxTitle, field, color, getDisasterIcon };
+ return { informationBoxTitle, field, style, getDisasterIcon };
};