Jquery ui 在ClojureScript和jayq中使用jquery ui
我正在尝试使用jayq和jquery.ui.sortable在页面上创建一个列表 可恶的。看着它,似乎它应该是一样的 简单到:Jquery ui 在ClojureScript和jayq中使用jquery ui,jquery-ui,clojurescript,Jquery Ui,Clojurescript,我正在尝试使用jayq和jquery.ui.sortable在页面上创建一个列表 可恶的。看着它,似乎它应该是一样的 简单到: (.sortable ($ :#sortable)) 其汇总如下: jayq.core.$.call(null, "\ufdd0'#sortable").sortable(); 并抛出: Uncaught TypeError: Cannot call method 'call' of undefined 当我试图将其包含在页面中时。有趣的是,生成的代码 当我将页面
(.sortable ($ :#sortable))
其汇总如下:
jayq.core.$.call(null, "\ufdd0'#sortable").sortable();
并抛出:
Uncaught TypeError: Cannot call method 'call' of undefined
当我试图将其包含在页面中时。有趣的是,生成的代码
当我将页面粘贴到js控制台时,它在页面中工作,这意味着
对我来说,在执行该行之后加载了一些必要的内容
我改了
(def cljs-options {:advanced {:externs ["externs/jquery.js"]}})
到
读后
,这似乎还不够。我猜jquery.ui
修改$Prototype,但我不确定如何在
clojurescript
如果有什么不同的话,我也在使用noir和noir cljs
仔细看,jQueryUI可能需要一个手动滚动的externs文件才能使用,这可能是一项重大任务。有人能证实吗?解决这个问题有两个不同的方面
$.prototype.sortable = function (a,b) { };
$.prototype.disableSelection = function (a,b) { };
(:require [noir.cljs.core :as cljs])
(:use [hiccup.page :only [include-js]])
...
(cljs/include-scripts :with-jquery)
(include-js "/js/jquery-ui.js")
(include-js "/js/jquery.js")
(include-js "/js/jquery-ui.js")
(include-js "/cljs/bootstrap.js") ;; Generated
(include-js "/js/jquery.js")
(include-js "/js/jquery-ui.js")
(include-js "/cljs/bootstrap.js") ;; Generated