[google map] CloseBuy APP
课程学习:https://www.udemy.com/course/vuejs-google-maps-api-for-beginners/learn/lecture/17820124#overview
此乃实践笔记。
Note 1
-
小结一
Ref: https://wpstorelocator.co/document/create-google-api-keys/
解决红色错误:注意替换掉代码中三处key。
-
小结二
先确定自定位可用。
API keys with referer restrictions cannot be used with this API.
Ref: https://developers.google.com/maps/faq#browser-keys-blocked-error
How do I resolve the error: "API keys with referer restrictions cannot be used with this API."?
You are using any of the web service APIs with an API key restricted to an HTTP referer. For security reasons, web service APIs need to use API keys restricted to IP addresses.
- Switch your key restriction type from an HTTP referer restriction to an IP address restriction,
- or create a new API key if your key is already used with the Maps JavaScript API.
改为IP, 然后查询本地的IP地址。其实报错的话,也会返回实际的公网IP地址。然后,添加进restrictions即可。
Note 2
{ "html_attributions" : [], "next_page_token" : "...", "results" : [ { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : -38.17194930000001, "lng" : 144.3246195 }, "viewport" : { "northeast" : { "lat" : -38.1706333697085, "lng" : 144.3258898802915 }, "southwest" : { "lat" : -38.1733313302915, "lng" : 144.3231919197085 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png", "name" : "Malee Thai Highton", "opening_hours" : { "open_now" : false }, "photos" : [ { "height" : 2448, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/101253280489579276620\"\u003eMalee Thai Highton\u003c/a\u003e" ], "photo_reference" : "ATtYBwLIOz63NuCx5m5QljGMRP ...", "width" : 3264 } ], "place_id" : "ChIJu1RLLAsT1GoRcRqwhkHKzGI", "plus_code" : { "compound_code" : "R8HF+6R Highton VIC, Australia", "global_code" : "4RH6R8HF+6R" }, "price_level" : 2, "rating" : 4.1, "reference" : "ChIJu1RLLAsT1GoRcRqwhkHKzGI", "scope" : "GOOGLE", "types" : [ "restaurant", "food", "point_of_interest", "establishment" ], "user_ratings_total" : 147, "vicinity" : "6/1-3 Belle Vue Avenue, Highton" }, { "business_status" : "OPERATIONAL", "geometry" : { "location" : { "lat" : -38.20058720000001, "lng" : 144.320429 }, "viewport" : { "northeast" : { "lat" : -38.1991842697085, "lng" : 144.3218761802915 }, "southwest" : { "lat" : -38.2018822302915, "lng" : 144.3191782197085 } } }, "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/cafe-71.png", "name" : "Panache Cafe & Creperie", "opening_hours" : { "open_now" : true }, "photos" : [ { "height" : 3518, "html_attributions" : [ "\u003ca href=\"https://maps.google.com/maps/contrib/112516884335859611512\"\u003eTahlia Foss\u003c/a\u003e" ], "photo_reference" : "ATtYBwKXoAHQLfebRYLNp ...", "width" : 3021 } ], "place_id" : "ChIJAas5rTYT1GoRDaLalPy2SVM", "plus_code" : { "compound_code" : "Q8XC+Q5 Waurn Ponds VIC, Australia", "global_code" : "4RH6Q8XC+Q5" }, "price_level" : 2, "rating" : 3.9, "reference" : "ChIJAas5rTYT1GoRDaLalPy2SVM", "scope" : "GOOGLE", "types" : [ "cafe", "restaurant", "food", "point_of_interest", "store", "establishment" ], "user_ratings_total" : 189, "vicinity" : "M4B, 173-199 Pioneer Road, Waurn Ponds" } ], "status" : "OK" }
Note 3
调整 Layout。宽度默认分成了16份。
Continue ...
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律