This commit is contained in:
姚宇浩 2024-07-24 15:34:35 +08:00
parent ea5d60501a
commit 8e5bf1953e
2 changed files with 10 additions and 8 deletions

View File

@ -13,7 +13,7 @@
<script setup> <script setup>
import Header from "../components/header.vue"; import Header from "../components/header.vue";
import { ref, onMounted, onBeforeMount ,watch} from "vue"; import { ref, onMounted, onBeforeMount ,watch, nextTick} from "vue";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
const router = useRouter(); const router = useRouter();
const routers = useRoute(); const routers = useRoute();
@ -21,9 +21,9 @@ console.log(routers.path);
watch( watch(
() => routers.path, () => routers.path,
(newVal, oldVal) => { (newVal, oldVal) => {
if (routers.path == '/home/index/map') { nextTick(()=>{
reset_font() reset_font()
} })
} }
); );
const reset_font = () => { const reset_font = () => {

View File

@ -390,7 +390,7 @@ const addPolygonCounty = () => {
let jdCenter = []; let jdCenter = [];
if (item.name == "溪口镇") { if (item.name == "溪口镇") {
if (!title_choose.value.includes("溪口镇")) { if (!title_choose.value.includes("溪口镇")) {
title_choose.value = title_choose.value + `>${polygon.name}`; title_choose.value = title_choose.value + `>${item.name}`;
} }
loadCs(); loadCs();
addPolygonCountyCs(); addPolygonCountyCs();
@ -402,6 +402,7 @@ const addPolygonCounty = () => {
addCs(); addCs();
goMapCenter(jdCenter, 13); goMapCenter(jdCenter, 13);
} else { } else {
title_choose.value='龙游县'
cs_qk_arr.value.forEach((item, index) => { cs_qk_arr.value.forEach((item, index) => {
map.removeOverlay(cs_qk_arr.value[index]); map.removeOverlay(cs_qk_arr.value[index]);
}); });
@ -567,7 +568,7 @@ const createCustomOverlayJd2 = (polygon, indexx) => {
title.appendChild(document.createTextNode(this.properties.title)); title.appendChild(document.createTextNode(this.properties.title));
content.appendChild(div); content.appendChild(div);
var number = document.createElement("div"); var number = document.createElement("div");
number.style.fontSize = "16px"; number.style.fontSize = "9px";
number.style.fontWeight = "600"; number.style.fontWeight = "600";
number.style.color = "rgba(0, 255, 189, 1)"; number.style.color = "rgba(0, 255, 189, 1)";
div.appendChild(number); div.appendChild(number);
@ -881,7 +882,7 @@ const changeRs = (id) => {
jdm_number_arr.value.forEach((item, index) => { jdm_number_arr.value.forEach((item, index) => {
map.removeOverlay(jdm_number_arr.value[index]); map.removeOverlay(jdm_number_arr.value[index]);
}); });
if (cs_number_name_arr.value) { if (cs_number_name_arr.value?.length) {
cs_number_name_arr.value.forEach((item, index) => { cs_number_name_arr.value.forEach((item, index) => {
map.removeOverlay(cs_number_name_arr.value[index]); map.removeOverlay(cs_number_name_arr.value[index]);
}); });
@ -901,6 +902,7 @@ const changeRs = (id) => {
// addJd(); // addJd();
// } // }
} else { } else {
console.log(8888);
// if(chooseArr.value.includes("jd_number")){ // if(chooseArr.value.includes("jd_number")){
// chooseArr.value = chooseArr.value.filter((item) => item !== "jd_number"); // chooseArr.value = chooseArr.value.filter((item) => item !== "jd_number");
// chooseArr.value.push("jd_noNumber"); // chooseArr.value.push("jd_noNumber");
@ -911,7 +913,7 @@ const changeRs = (id) => {
jdm_arr.value.forEach((item, index) => { jdm_arr.value.forEach((item, index) => {
map.removeOverlay(jdm_arr.value[index]); map.removeOverlay(jdm_arr.value[index]);
}); });
if (cs_name_arr.value) { if (cs_name_arr.value?.length) {
cs_name_arr.value.forEach((item, index) => { cs_name_arr.value.forEach((item, index) => {
map.removeOverlay(cs_name_arr.value[index]); map.removeOverlay(cs_name_arr.value[index]);
}); });