聚合物select2元素 [英] Polymer select2 element

查看:91
本文介绍了聚合物select2元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试包装出色的select2 jQuery小部件( https://github.com/ivaynberg/select2)在Polymer元素中,以方便重复使用.我能够正确初始化选择,但初始化后遇到问题.具体来说,当单击选择以将其打开时,将弹出窗口定位在select2脚本中会引发类型错误.这是执行失败的仓库:

I am attempting to wrap the great select2 jquery widget (https://github.com/ivaynberg/select2) in a Polymer element for easy reuse. I was able to get the select initialized correctly, but am running into issues after initialization. Specifically, when clicking the select to open it a type error is thrown in the select2 script when positioning the pop over. Here is a repo with the failing implementation:

https://github.com/ivelander/x-select2

总体上,有没有人成功地将Polymer与此select2小部件或jquery小部件集成在一起?关于如何使该示例起作用的任何建议?

Has anyone had good success integrating Polymer with this select2 widget or jquery widgets in general? Any suggestions on how I might get this example to work?

推荐答案

由于jQuery需要访问进入影子DOM边界的文档中的所有节点,因此在Polymer元素中包装jQuery插件目前无法可靠地工作.完整说明此处.

Wrapping jQuery plugins in a Polymer element does not currently reliably work due to jQuery's need to access all nodes in the document running into the boundaries of the shadow DOM. Full explanation here.

这篇关于聚合物select2元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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