我正在尝试使用Laravel的vue-google-maps包,但是使用文档中最基本的设置我不断得到“[Vue警告]:未知的自定义元素: - 你是否正确注册了组件?”错误 .
app.js
require('./bootstrap');
window.Vue = require('vue');
import * as VueGoogleMaps from 'vue2-google-maps'
Vue.use(VueGoogleMaps, {
load: {
key: 'MY_KEY',
libraries: 'places',
},
});
const app = new Vue({
el: '#app'
});
在我的刀片文件中
<div id="app">
<GmapMap
:center="{lat:10, lng:10}"
:zoom="7"
map-type-id="terrain"
style="width: 500px; height: 300px">
<GmapMarker
:key="index"
v-for="(m, index) in markers"
:position="m.position"
:clickable="true"
:draggable="true"
@click="center=m.position"
/>
</GmapMap>
</div>
注意:我编译了我的JS,并在我的blade.html文件中引用它 .