javascript - 在 vue.js 中实现谷歌自动完成的问题
问题描述
我正在尝试在带有 laravel 的 vue.js 中使用谷歌自动完成,但它给了我错误:
[Vue warn]: Error in mounted hook: "ReferenceError: google is not defined" found in ---> <VueGoogleAutocomplete> at /src/components/VueGoogleAutocomplete.vue <App> at /src/App.vue <Root>
这是我要实现的代码的链接:
解决方案
检查您的代码框后,我注意到您没有在 public/index.html 的 head 标记中包含 Google Maps Places API。
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_HERE&libraries=places"></script>
推荐阅读
- ssis - 用于将记录插入数据库的 C# 或 BIML 代码
- python - 使用一种热编码的 LSTM 输入
- elasticsearch - Elasticsearch 边缘 ngram 标记器返回不太相关的项目
- matrix - 复制构造函数以创建一个元素向量矩阵
- karate - 将配置作为 karate.callSingle() 的一部分传递的问题
- haskell-stack - 来自...的不受支持的 tarball 位于“结果”的文件是指向绝对路径的符号链接
- docker - 在 docker-compose 中强制创建绑定挂载
- vue.js - 如何通过 Django 模板将 FOR LOOP 数据动态传递给 Vue 组件?
- javascript - 如何使用 Webpack & Terser 只压缩代码
- python - 字典可以添加到字典吗?