我想进入 meteor.js 来开发一个应用程序,因为它非常棒,而且似乎使 Web 开发变得如此简单。
问题是该应用程序将有 2 个连接的可排序嵌套列表,我打算使用 emjqueryui 对其进行排序。
我找不到太多关于将 jqueryui 与 meteor.js 结合使用的示例或信息,只有很久以前使用 spark 之前的旧版本 meteor 的少数示例或信息。
任何人都可以告诉我这是如何工作的,推荐的结合使用的方法是什么,如果可能的话,还有一个例子或对此的任何引用。
还建议将它们一起使用,还是我应该使用另一种方式/库?
非常感谢 瑞克
最佳答案
瑞克, 我将 jquery-ui(以及其他基于 jquery 的插件)与 meteor 一起使用就好了。通常,当呈现相关模板时,我会为该元素提供其 jquery-ui-ness,例如(在 coffeescript 中):
# 'this' references the template
Template.listOne.rendered = ->
$(this.firstNode).find('ul.connectedSortable').sortable
connectWith: '.connectedSortable'
Template.listTwo.rendered = ->
$(this.firstNode).find('ul.connectedSortable').sortable
connectWith: '.connectedSortable'
或者,您可以在某个事件后使元素可排序,例如:
# 'this' now equals Window, so we must find the list from the event target
Template.listOne.events
'click button': (e) ->
$(e.target).parent().find('ul.connectedSortable').sortable
connectWith: '.connectedSortable'
关于javascript - Jqueryui 与 meteor.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12980678/