hello}-6ren">
gpt4 book ai didi

javascript - 谷歌地图 API 3 : how to solve error of "unexpected token <"?

转载 作者:行者123 更新时间:2023-12-03 06:44:19 25 4
gpt4 key购买 nike

我试图将谷歌地图初始化的工作代码放入 meteor 项目中,并收到两个错误:Unexpected token <initMap is not a function 。我给出的html文件代码如下:

<head>
<title>simple</title>
</head>

<body>
<h1>Welcome to Meteor!</h1>

{{> hello}}
{{> info}}
<script src="main.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBNRzOGCsGk5u0VHjDOh_4QyJf4K-Hz5Bw&signed_in=true&libraries=places&callback=initMap"
async defer></script>
</body>

<template name="hello">
<button>Click Me</button>
<p>You've pressed the button {{counter}} times.</p>
</template>

<template name="info">
<h2>Learn Meteor!</h2>
<ul>
<li><a href="https://www.meteor.com/try">Do the Tutorial</a></li>
<li><a href="http://guide.meteor.com">Follow the Guide</a></li>
<li><a href="https://docs.meteor.com">Read the Docs</a></li>
<li><a href="https://forums.meteor.com">Discussions</a></li>
</ul>
</template>

最佳答案

使用atmospherejs中的这个包 dburles:google-maps

文档解释得很好。

你不需要添加 main.js,meteor 会处理这个事情。

您也可以看到此示例 example

关于javascript - 谷歌地图 API 3 : how to solve error of "unexpected token <"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37812500/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com