|
@@ -51,7 +51,7 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { Dropdown, MenuItem, Menu } from "ant-design-vue";
|
|
|
-import { computed, ref } from "vue";
|
|
|
+import { computed, ref, watch, onMounted } from "vue";
|
|
|
import BackItem from "./back-item.vue";
|
|
|
import { fetchMapTiles } from "@/api/map-tile";
|
|
|
import { sysTiles } from "@/store";
|
|
@@ -59,7 +59,7 @@ import { sysTiles } from "@/store";
|
|
|
const props = defineProps<{
|
|
|
value: [string | null | undefined, number | null | undefined];
|
|
|
}>();
|
|
|
-defineEmits<{
|
|
|
+const emit = defineEmits<{
|
|
|
(e: "update:value", value: [string | null, number | null]): void;
|
|
|
}>();
|
|
|
|
|
@@ -98,6 +98,14 @@ const backs = computed(() => [
|
|
|
},
|
|
|
]);
|
|
|
|
|
|
+// 添加默认选中逻辑
|
|
|
+onMounted(() => {
|
|
|
+ // 如果没有获取到默认值(value[0]和value[1]都为空),则默认选中"无"选项
|
|
|
+ if (!props.value[0] && !props.value[1]) {
|
|
|
+ emit("update:value", ["none", null]);
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
const activeParent = computed(() => {
|
|
|
for (const back of backs.value) {
|
|
|
if (back.value === props.value[0]) {
|