在 form.io 应用程序中输入 Google 地图 API 键的位置
Where to enter Google Maps API key in form.io app
我正在开发我的第一个 Form.io 应用程序,根据我在各种演示中看到的演示,当您使用地址字段时,将显示一个 Google 地图查看表单时的地址。根据the documentation,我需要在index.html中的头部添加如下代码:
<script src="https://maps.google.com/maps/api/js"></script>
但是,我在控制台中收到此错误:
Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
form.io 应用程序中是否有我 can/need 输入 API 键值的地方?
谢谢。
API 密钥可以输入到主存储库中的 src/index.html 文件中。你可以在
看到它
https://github.com/formio/formio-app-servicetracker/blob/master/src/index.html
替换
<script src="https://maps.google.com/maps/api/js"></script>
和
<script src="https://maps.google.com/maps/api/js?key=YOUR_API_KEY"></script>
您可以在 https://developers.google.com/maps/documentation/javascript/get-api-key
找到有关获取 google 地图密钥的更多信息
您是在您的网站上手动附加地图脚本,还是使用插件?你能把你的网站发到这里吗URL?无论如何,这是附加 API 键的方法:假设您有以下代码
<script async defer src="//maps.googleapis.com/maps/api/js" type="text/javascript"></script>
要附加 apy 密钥,必须在 src 路径末尾添加 ?key=YOUR_API_KEY,如下所示:
<script async defer src="//maps.googleapis.com/maps/api/js?key=YOUR_API_KEY" type="text/javascript"></script>
如果您的 src 路径已经有一些附加参数(例如,“//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false
”),只需在最后添加 &key=YOUR_API_KEY
:“//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=YOUR_API_KEY
” 这是您附加 API 参数的方式(显然,将 YOUR_API_KEY 替换为您的 API 键码)。
有关 google 映射键的更多信息位于
https://developers.google.com/maps/documentation/javascript/get-api-key
您的 API 键应该会在 5 分钟内启动并 运行。享受吧!
我正在开发我的第一个 Form.io 应用程序,根据我在各种演示中看到的演示,当您使用地址字段时,将显示一个 Google 地图查看表单时的地址。根据the documentation,我需要在index.html中的头部添加如下代码:
<script src="https://maps.google.com/maps/api/js"></script>
但是,我在控制台中收到此错误:
Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
form.io 应用程序中是否有我 can/need 输入 API 键值的地方?
谢谢。
API 密钥可以输入到主存储库中的 src/index.html 文件中。你可以在
看到它https://github.com/formio/formio-app-servicetracker/blob/master/src/index.html
替换
<script src="https://maps.google.com/maps/api/js"></script>
和
<script src="https://maps.google.com/maps/api/js?key=YOUR_API_KEY"></script>
您可以在 https://developers.google.com/maps/documentation/javascript/get-api-key
找到有关获取 google 地图密钥的更多信息您是在您的网站上手动附加地图脚本,还是使用插件?你能把你的网站发到这里吗URL?无论如何,这是附加 API 键的方法:假设您有以下代码
<script async defer src="//maps.googleapis.com/maps/api/js" type="text/javascript"></script>
要附加 apy 密钥,必须在 src 路径末尾添加 ?key=YOUR_API_KEY,如下所示:
<script async defer src="//maps.googleapis.com/maps/api/js?key=YOUR_API_KEY" type="text/javascript"></script>
如果您的 src 路径已经有一些附加参数(例如,“//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false
”),只需在最后添加 &key=YOUR_API_KEY
:“//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=YOUR_API_KEY
” 这是您附加 API 参数的方式(显然,将 YOUR_API_KEY 替换为您的 API 键码)。
有关 google 映射键的更多信息位于
https://developers.google.com/maps/documentation/javascript/get-api-key
您的 API 键应该会在 5 分钟内启动并 运行。享受吧!