我在这个应用程序,我有地图的申请,但如果我加载应用程序的地图加载这样的:谷歌地图V3仅渲染图,如果调整浏览器
的应用与Vuejs开发的Laravel和地图是根据下面的代码经由VUE部件装载的其它compoinent的内部:
<template>
<div class="google-map">
<div :id="mapName" style="height: 100%"></div>
</div>
</template>
<style scoped>
.google-map {
width: 100%;
height: 500px;
margin: 0;
padding: 0;
background: gray;
}
/*body, html #map-canvas {
height: 100%;
width: 100%;
}*/
</style>
<script>
export default {
name: 'google-map',
props: ['name'],
data() {
return {
mapName: this.name + "-map",
}
},
mounted() {
this.initMap();
},
methods: {
initMap() {
const element = document.getElementById(this.mapName);
const options = {
zoom: 14,
center: new google.maps.LatLng(51.501527,-0.1921837)
};
var map = new google.maps.Map(element, options);
}
}
}
</script>
在它被加载组件,我使用此代码:
<google-map name="example"></google-map>
我已经尝试了所有可能的解决方案并没有获得该地图,而不必调整浏览器窗口中加载了预期的结果。你能解决这个问题吗?
为什么你没有身体和HTML? – scaisEdge
,因为内容是为html上的vuejs注入的。好奇的是,如果我做了谷歌执行与HTML和使用iframe它的工作原理,但我需要它没有IFRAME –