<template>
<gmap-map
:center="center"
:zoom="11"
:options="mapStyle"
style="height: 60vh;"
>
<gmap-marker
:key="index"
v-for="(m, index) in markers"
:position="m.position"
:clickable="true"
:draggable="true"
@click="center=m.position">
</gmap-marker>
</gmap-map>
</template>
import * as VueGoogleMaps from 'vue2-google-maps';
import Vue from 'vue';
Vue.use(VueGoogleMaps, {
load: {
key: 'AIzaSyB3Dll79BdxJTlWtovrOnP2Vx4IUlSOlGg'
},
});
export default {
data() {
return {
center: {lat: 40.731266336572205 , lng: -73.99026142354683},
markers: [
{
position: {lat: 40.731266336572205 , lng: -73.99026142354683},
}],
};
},
};
Run Code Online (Sandbox Code Playgroud)
在我的页面上,我将使用谷歌地图。这没问题,此代码有效,但是可以在地图上设置自定义颜色吗?让我们说像这里:在此处输入链接描述。使用 Google Maps JavaScript 这很简单,但是如何使用 vue2-Google-maps 获得相同的效果??一些道具什么的?