小编y'f*_*fre的帖子

vue2-google-maps 自定义样式

<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 获得相同的效果??一些道具什么的?

vue.js vue-component vuejs2

4
推荐指数
1
解决办法
3372
查看次数

标签 统计

vue-component ×1

vue.js ×1

vuejs2 ×1