Autocomplete / Autofill with Polymer input elements (gold-email-input)

雨燕双飞 提交于 2019-12-23 17:52:12

问题


I'm having an issue getting Chrome's autofill and/or autocomplete working with Polymer input elements, such as gold-email-input. I've tried setting the autocomplete attribute of the gold-email-input component to on and I've also tried setting it to email. The autofill box appears, but selecting an entry from the autofill selections does not populate the control. What am I doing wrong?


回答1:


<form is="iron-form">
  <gold-email-input></gold-email-input>
</form>

This tends to work




回答2:


You don't need to set the autocomplete attribute, as it's already set to autocomplete=email.

I think we need to see a sample of your code in context because the input automatically populates for me when I select the autofill suggestion:

jsbin




回答3:


Try wrapping your input elements in a form element. This works for me:

<form>
     <paper-input id="user"
                   autocomplete="email"
                   label="Username or email"
                   value="{{user}}"
      </paper-input>
      <paper-input id="pwd"
                   autocomplete="current-password"
                   label="Password"
                   value="{{pwd}}"
      </paper-input>
</form>


来源:https://stackoverflow.com/questions/37330074/autocomplete-autofill-with-polymer-input-elements-gold-email-input

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!