简体   繁体   English

将google maps自动完成搜索框添加到使用budeecore框架构建的项目中

[英]adding google maps autocomplete search box into a project built with sproutecore framework

I'm new to sproutecore framework, I noticed that things works pretty different than building a web app on pure javascript with jquery (for example) 我是prunepecore框架的新手,我注意到它的工作原理与使用jQuery在纯JavaScript上构建Web应用程序大为不同(例如)

Hence, I didn't understand how can I insert and bind a google maps searchbox view into my web app (in pure js it was just including the google api script and instantiating an object. something like that : autocompleteDeparture = new google.maps.places.Autocomplete(departureField, options); ) 因此,我不明白如何将google maps搜索框视图插入并绑定到我的网络应用程序中(在纯js中,它只是包括google api脚本并实例化一个对象。类似这样的东西: autocompleteDeparture = new google.maps.places.Autocomplete(departureField, options);

You typically put any outside JS files in a frameworks directory and then you can use it just like you included it in a <script> tag. 通常,您将所有外部JS文件放在frameworks目录中,然后就可以像将其包含在<script>标记中一样使用它。

That said, you will probably want to execute your Google Maps code inside of the SC.View 's didAppendToDocument() method so that you are sure it is visible and the Google Maps code can properly bind to it. 就是说,您可能希望在SC.ViewdidAppendToDocument()方法内执行Google Maps代码,以确保它可见并且Google Maps代码可以正确地绑定到它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM