是否有用于Polymer 1.0的内置自动完成输入组件? [英] Are there any built in auto-complete input components for Polymer 1.0?

查看:73
本文介绍了是否有用于Polymer 1.0的内置自动完成输入组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从Polymer 1.0发行以来,我一直在摸索,我遇到了一个用例,其中选择列表就不够用(可供选择的选项太多).我真正需要的是一个自动完成的文本框.

I've been muddling around with Polymer 1.0 since its release, and I've hit a use case where a select list just won't be sufficient (too many options to select from). What I really need is an autocomplete textbox.

纸质或铁质聚合物控件中是否内置或计划有一个?还是我应该考虑其他框架的自动完成解决方案?到目前为止,我已经能够使我的应用保持轻量化,如果可以帮助的话,我宁愿避免使用其他框架.

Is there one built-in or planned in the paper or iron Polymer controls? Or should I be looking at autocomplete solutions from other frameworks? So far, I've been able to keep my app light-weight, and I'd prefer to avoid other frameworks if I can help it.

谢谢

瑞安

我见过的提出第一方开发的自动完成功能的最佳位置是GitHub上的PolymerElements/paper-elements回购.我会在 https://github.com/PolymerElements/paper-elements/issues/26 上进行讨论

The best place I've seen to bring up a first-party developed autocomplete is on the PolymerElements/paper-elements repo on GitHub. I'd discuss at https://github.com/PolymerElements/paper-elements/issues/26.

推荐答案

就目前而言,我已经决定将HTML5数据列表与经过修改的<paper-input>控件结合使用(我已向Github存储库提交了一个拉取请求,将这些更改合并回master分支).所有这些更改都是将list属性保留到内部<iron-input>控件中,以便它可以利用HTML5数据列表.

For now, I've settled on using HTML5 datalists in conjunction with a modified <paper-input> control (I've submitted a pull request to the Github repo to merge those changes back into the master branch). All those changes do is persist the list attribute to the inner <iron-input> control so that it can utilize an HTML5 datalist.

绝对不是理想的选择,但是在短期内,它将代替实际的预输入控件用作占位符.

Definitely not ideal, but, in the short-term, it'll function as a placeholder in place of a real typeahead control.

我还构建了一个快速的自定义验证器,该验证器遍历与我在数据列表中使用的数组集合相同的Array集合,以便<paper-input>控件知道当前值是否为可选(有效)值.

I also built a quick custom validator that iterates over the same Array collection as what I use in my datalist so that the <paper-input> control knows if the current value is a selectable (valid) value or not.

我见过的提出第一方开发的自动完成功能的最佳位置是GitHub上的PolymerElements/paper-elements回购.我将在 https://github.com/PolymerElements/paper-elements/issues/中进行讨论26 .

The best place I've seen to bring up a first-party developed autocomplete is on the PolymerElements/paper-elements repo on GitHub. I'd discuss at https://github.com/PolymerElements/paper-elements/issues/26.

这篇关于是否有用于Polymer 1.0的内置自动完成输入组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆