Commit ce43791c authored by youjie's avatar youjie

no message

parent ee990886
...@@ -151,7 +151,6 @@ export default { ...@@ -151,7 +151,6 @@ export default {
}, },
dataAll: { dataAll: {
handler(val, oldVal) { handler(val, oldVal) {
// console.log(val,'-------')
if (this.NationList.length == 0) this.getAddress(1); if (this.NationList.length == 0) this.getAddress(1);
if (val.TripMapList.length == 0) this.SearchCity(2); if (val.TripMapList.length == 0) this.SearchCity(2);
if (val.TripMapList.length > 0) { if (val.TripMapList.length > 0) {
...@@ -192,7 +191,12 @@ export default { ...@@ -192,7 +191,12 @@ export default {
}, },
computed: {}, computed: {},
mounted() { mounted() {
this.map = new mapboxgl.Map({ this.initMap()
},
methods: {
// 初始化地图
initMap(){
this.map = new mapboxgl.Map({
container: "trip_map", container: "trip_map",
style: "mapbox://styles/alex9012/clm92pvs1011j01qzexlh6g2b", // 'mapbox://styles/mapbox/light-v9','mapbox://styles/alex9012/clm92pvs1011j01qzexlh6g2b' style: "mapbox://styles/alex9012/clm92pvs1011j01qzexlh6g2b", // 'mapbox://styles/mapbox/light-v9','mapbox://styles/alex9012/clm92pvs1011j01qzexlh6g2b'
center: [2.177432, 41.382894], center: [2.177432, 41.382894],
...@@ -232,10 +236,7 @@ export default { ...@@ -232,10 +236,7 @@ export default {
} }
}); });
//this.addDocumentEventListener(); //this.addDocumentEventListener();
},
// this.initializeData()
},
methods: {
// 导出地图片 // 导出地图片
getResultImg() { getResultImg() {
this.setLoading = true this.setLoading = true
...@@ -323,6 +324,7 @@ export default { ...@@ -323,6 +324,7 @@ export default {
await this.addCountriesMaker(); //标记名字 await this.addCountriesMaker(); //标记名字
} }
}, },
// 获取国家
async getAddress(Type) { async getAddress(Type) {
this.loading = true; this.loading = true;
await this.apipost( await this.apipost(
...@@ -378,6 +380,7 @@ export default { ...@@ -378,6 +380,7 @@ export default {
getColorStr(){ getColorStr(){
this.dataAll.TripMapList = JSON.parse(JSON.stringify(this.TripMapList)); this.dataAll.TripMapList = JSON.parse(JSON.stringify(this.TripMapList));
}, },
// 城市ids
getCityListIds(x, index) { getCityListIds(x, index) {
x.CityList = []; x.CityList = [];
let obj = { let obj = {
...@@ -412,6 +415,7 @@ export default { ...@@ -412,6 +415,7 @@ export default {
this.$forceUpdate(); this.$forceUpdate();
this.dataAll.TripMapList = JSON.parse(JSON.stringify(this.TripMapList)); this.dataAll.TripMapList = JSON.parse(JSON.stringify(this.TripMapList));
}, },
// 查询城市
SearchCity(MId, x, index) { SearchCity(MId, x, index) {
if (x) { if (x) {
x.NationList.forEach(item => { x.NationList.forEach(item => {
...@@ -660,7 +664,7 @@ export default { ...@@ -660,7 +664,7 @@ export default {
.setLngLat(result) .setLngLat(result)
.addTo(this.map); .addTo(this.map);
const offset = marker.getOffset(); const offset = marker.getOffset();
console.log(offset, "----"); console.log(offset, "----offset");
} }
}) })
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment