我目前正在开发一个 Next.js 项目,我正在寻找最好的 npm 包来集成 Google 地图平台。尽管进行了广泛的搜索,我仍然无法找到合适的包或关于如何实现它的清晰文档。有人可以提供有关如何有效地将 Google Maps Platform 集成到 Next.js 项目中的建议或指导吗?任何帮助或见解将不胜感激。
我尝试了react-google-maps/api,但它没有指南
尝试使用“@next/third-party”库:
import { GoogleMapsEmbed } from '@next/third-parties/google'
export default function Page() {
return (
<GoogleMapsEmbed
apiKey="XYZ"
height={200}
width="100%"
mode="place"
q="Brooklyn+Bridge,New+York,NY"
/>
)
}
这是文档: https://nextjs.org/docs/app/building-your-application/optimizing/third-party-libraries