如何使用vue2-google-maps显示Google Maps [英] How to display Google Maps with vue2-google-maps

查看:856
本文介绍了如何使用vue2-google-maps显示Google Maps的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中使用vue2-google-maps,但该地图未显示.我仔细阅读了文档,了解如何使用它,但我唯一看到的是是空白页面,而不是Google地图.控制台中没有错误.

I would like to use vue2-google-maps in my app but the map is not showing. I followed the documentation carefully on how to use it but the only thing I see is a blank white page instead of google maps. There are no errors in the console.

这是我的代码:

<template>
  <gmap-map :center="{
      lat: 47.2736,
      lng: 16.0843
    }"></gmap-map>
</template>

<script>
export default {
  data: () => {
    return {}
  }
</script>

如您所见,这是最简单的实现,但是我所看到的只是一张空白的白页.我检查了页面,可以看到vue-map容器和所有元素,但地图未显示在应用程序中.

As you can see it's the simplest possible implementation but all I see is a blank white page. I inspected the page and I can see the vue-map container and all the elements but the map doesn't show in the app.

推荐答案

好像我只需要添加zoom道具:

Looks like I just had to add the zoom prop:

<template>
  <gmap-map :center="{
      lat: 47.2736,
      lng: 16.0843
    }" 
    :zoom="7"></gmap-map>
</template>

这篇关于如何使用vue2-google-maps显示Google Maps的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆