Javascript vue谷歌地图-如何设置地图样式?
所以我用了,在尸体上放了一张地图。我想在地图上添加一些样式,但不知道如何进行。当使用Vanilla.js时,我可以只添加带有Javascript vue谷歌地图-如何设置地图样式?,javascript,google-maps,vue.js,vue-component,Javascript,Google Maps,Vue.js,Vue Component,所以我用了,在尸体上放了一张地图。我想在地图上添加一些样式,但不知道如何进行。当使用Vanilla.js时,我可以只添加带有theMap.setOptions({styles:style\u array})的样式,但是如何使用它呢 这是我的设置: DOM <google-map style="width: 100%; height: 100%; position: absolute; left:0; top:0" :center="{ lat: 30.2672, l
theMap.setOptions({styles:style\u array})
的样式,但是如何使用它呢
这是我的设置:
DOM
<google-map style="width: 100%; height: 100%; position: absolute; left:0; top:0"
:center="{ lat: 30.2672, lng: -97.7431 }"
:zoom="12"
>
</google-map>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.6.1/lodash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.21/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-google-maps/0.1.17/vue-google-maps.js"></script>
<script type="text/javascript" src="/js/[JS-FILE]"></script>
<google-map style="width: 100%; height: 100%; position: absolute; left:0; top:0"
:center="{ lat: 30.2672, lng: -97.7431 }"
:zoom="12"
v-bind:options="mapStyle"
>
</google-map>
我曾尝试将样式添加到api键&sat
:styles:“style\u array”
添加到DOM,但没有任何效果。有人知道如何使用Vue.js设置地图样式吗?彻底阅读了Vue google maps文档后,我意识到在启动google map元素时,有一个选项可以设置“:options:[style]”
我在JS中设置样式,并将其传递给客户端,如下所示:
DOM
<google-map style="width: 100%; height: 100%; position: absolute; left:0; top:0"
:center="{ lat: 30.2672, lng: -97.7431 }"
:zoom="12"
>
</google-map>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.6.1/lodash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.21/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue-google-maps/0.1.17/vue-google-maps.js"></script>
<script type="text/javascript" src="/js/[JS-FILE]"></script>
<google-map style="width: 100%; height: 100%; position: absolute; left:0; top:0"
:center="{ lat: 30.2672, lng: -97.7431 }"
:zoom="12"
v-bind:options="mapStyle"
>
</google-map>