我正在使用vue2-google-maps包在我的Nuxt应用程序上实现google map。
包装:https://www.npmjs.com/package/vue2-google-maps
现在我需要选择一个特定的位置lan和lat ..
插件:
import Vue from 'vue'
import * as VueGoogleMaps from 'vue2-google-maps'
Vue.use(VueGoogleMaps, {
load: {
key: 'AIzaSyC5Jrp9PtHe0WapppUzxbIpMDWMAcV3qE4',
libraries: 'places',
},
})
组件:
<template>
<v-layout row justify-center align-center>
<GmapMap
:center="{lat:10, lng:10}"
:zoom="7"
map-type-id="terrain"
style="width: 800px; height: 500px"
>
<GmapMarker
:key="index"
v-for="(m, index) in markers"
:position="m.position"
:clickable="true"
:draggable="true"
@click="center=m.position"
/>
</GmapMap>
</v-layout>
</template>
<script>
export default {
data() {
return {
markers: [
{position: { lng: 10.2, lat: 10 }},
]
};
}
};
</script>
Nuxt配置:
plugins: [
'@/plugins/axios.js',
{ src: '~/plugins/fc', ssr: false },
{src:"~plugins/vue2-google-maps.js"}
],
如何从中选择位置??