gpt4 book ai didi

javascript - Google Places Autocomplete 没有出现

转载 作者:行者123 更新时间:2023-11-29 15:25:32 24 4
gpt4 key购买 nike

组件

import Ember from 'ember';

export default Ember.TextField.extend({
type: 'text',

didInsertElement: function() {
this.$().addClass("form-control");
var autocomplete = new google.maps.places.Autocomplete(
(document.getElementById('autocomplete')),{types:['geocode']} //trying without jQuery, but still.
);
}});

模板

{{gp-textfield id="autocomplete"}}

呈现给

<input id="autocomplete" type="text" class="ember-view ember-text-field form-control" placeholder="Enter a location" autocomplete="off">

但是,我仍然得到:

InvalidValueError: not an instance of HTMLInputElement

非常感谢任何帮助。

编辑:Ember 2.6

清理了一下代码,没有用

didInsertElement: function() {
this.$().addClass("form-control");
var element = document.getElementById('autocomplete');
var autocomplete = new google.maps.places.Autocomplete(element);
}

最佳答案

使用 chrome 中的网络选项卡。

显然我的 API key 未被授权使用此功能,我必须启用它。

关于javascript - Google Places Autocomplete 没有出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39665256/

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