【发布时间】:2018-04-09 16:02:00
【问题描述】:
<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},
}],
};
},
};
在我的页面上,我将使用谷歌地图。没问题,这段代码有效,但是这可以在地图上设置自定义颜色吗?让我们在这里说:enter link description here。使用 Google Maps JavaScript 这很简单,但是如何使用 vue2-Google-maps 获得相同的效果?一些道具什么的?
【问题讨论】:
-
你能展示一下
mapStyle的样子吗?
标签: vue.js vuejs2 vue-component