|
@@ -14,8 +14,6 @@ export default {
|
|
|
data() {
|
|
|
//这里存放数据
|
|
|
return {
|
|
|
- keywords: "",
|
|
|
- arr: [],
|
|
|
map: null,
|
|
|
};
|
|
|
},
|
|
@@ -29,19 +27,19 @@ export default {
|
|
|
window.onLoad = () => {
|
|
|
this.map = new AMap.Map("myMap", {
|
|
|
zoom: 18,
|
|
|
- center: [this.$route.params.x, this.$route.params.y],
|
|
|
+ center: [this.$route.query.x, this.$route.query.y],
|
|
|
// viewMode: '3D'
|
|
|
});
|
|
|
const marker = new AMap.Marker({
|
|
|
- position: [this.$route.params.x, this.$route.params.y], // 位置
|
|
|
+ position: [this.$route.query.x, this.$route.query.y], // 位置
|
|
|
label: {
|
|
|
offset: new AMap.Pixel(20, 20),
|
|
|
content: "点击打开高德地图",
|
|
|
},
|
|
|
});
|
|
|
- marker.on("click", function (e) {
|
|
|
+ marker.on("click", (e) => {
|
|
|
marker.markOnAMAP({
|
|
|
- name: this.$route.params.name,
|
|
|
+ name: this.$route.query.name,
|
|
|
position: marker.getPosition(),
|
|
|
});
|
|
|
});
|
|
@@ -65,20 +63,20 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
- created() {
|
|
|
- window.document.title='景点导航'
|
|
|
+ created() {
|
|
|
+ window.document.title = "景点导航";
|
|
|
},
|
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {
|
|
|
this.initMap();
|
|
|
},
|
|
|
- beforeCreate() { }, //生命周期 - 创建之前
|
|
|
- beforeMount() { }, //生命周期 - 挂载之前
|
|
|
- beforeUpdate() { }, //生命周期 - 更新之前
|
|
|
- updated() { }, //生命周期 - 更新之后
|
|
|
- beforeDestroy() { }, //生命周期 - 销毁之前
|
|
|
- destroyed() { }, //生命周期 - 销毁完成
|
|
|
- activated() { }, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+ beforeCreate() {}, //生命周期 - 创建之前
|
|
|
+ beforeMount() {}, //生命周期 - 挂载之前
|
|
|
+ beforeUpdate() {}, //生命周期 - 更新之前
|
|
|
+ updated() {}, //生命周期 - 更新之后
|
|
|
+ beforeDestroy() {}, //生命周期 - 销毁之前
|
|
|
+ destroyed() {}, //生命周期 - 销毁完成
|
|
|
+ activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
};
|
|
|
</script>
|
|
|
<style lang='less' scoped>
|
|
@@ -96,7 +94,7 @@ export default {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
- /deep/.amap-marker-label{
|
|
|
+ /deep/.amap-marker-label {
|
|
|
// color: red;
|
|
|
}
|
|
|
}
|