【问题标题】:Jqueryui with meteor.jsJqueryui 与流星.js
【发布时间】:2012-10-10 10:44:26
【问题描述】:

我想进入 meteor.js 开发一个应用程序,因为它令人惊叹,并且似乎使 Web 开发变得如此简单。

问题是应用程序将有 2 个连接的可排序嵌套列表,我将使用 mjqueryui 对其进行排序。

我找不到太多关于将 jqueryui 与流星.js 结合使用的示例或信息,只有一些很久以前使用 spark 之前的旧版本流星的示例或信息。

谁能告诉我这是如何工作的,推荐的同时使用它们的方法是什么,如果可能的话,可以举个例子或对此的任何参考。

还建议将它们一起使用,还是我应该使用其他方式/库?

非常感谢 瑞克

【问题讨论】:

  • Meteor.js 很棒 :)

标签: javascript jquery jquery-ui meteor


【解决方案1】:

瑞克, 我使用 jquery-ui(以及其他基于 jquery 的插件)和流星就好了。一般来说,当相关模板被渲染时,我会给元素它的 jquery-ui-ness,例如(在咖啡脚本中):

# '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'

【讨论】:

  • jquery-ui 是一个流星包还是你只是修补它?我不确定合并外部代码片段的最佳方式。非常感谢。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-10-27
  • 2012-05-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-13
相关资源
最近更新 更多