更改查找不显示问题

This commit is contained in:
admin-lmm
2023-08-03 12:11:31 +08:00
parent cf0e63b45e
commit ad47713c94

View File

@@ -485,7 +485,7 @@ export default {
// console.log("data", data); // data就是它传过来的值 // console.log("data", data); // data就是它传过来的值
// console.log("原始this.station", this.station); // console.log("原始this.station", this.station);
// 地址 // 地址
this.detailedAddress = data.address; // this.detailedAddress = data.address;
// console.log("详细地址", data.address); // console.log("详细地址", data.address);
var adcode = data.adcode; var adcode = data.adcode;
var areaCode = []; var areaCode = [];
@@ -498,14 +498,15 @@ export default {
this.station.stationLng = String(data.pos[0]); this.station.stationLng = String(data.pos[0]);
this.station.stationLat = String(data.pos[1]); this.station.stationLat = String(data.pos[1]);
// console.log("修改后this.station", this.station); // console.log("修改后this.station", this.station);
console.log(data.address,'data.address')
this.station.address = data.address.includes('区') ? data.address.replace(/区/, ' ').split(' ')[1] : data.address
// 优化之后 // 优化之后
let newAddress2 = this.detailedAddress // let newAddress2 = this.detailedAddress
.replace(/(?<=[省市区])/g, "$&,") // .replace(/(?<=[省市区])/g, "$&,")
.split(","); // .split(",");
let end = newAddress2.pop(); // let end = newAddress2.pop();
console.log("详细地址", end); // console.log("详细地址",this.station.areaCode,newAddress2);
this.station.address = end; // this.station.address = newAddress2;
}); });
}, },
computed: { computed: {