2013-08-02 37 views
3

我想设置从clojurescript的element.style.height属性,但是这个代码不幸失败:如何在Clojurescript中设置嵌套属性值?

(set! (-> (sel1 tr :.ragslide) .-style .-height) (content-height)) 

(SEL1选择DOM元素,它是从Dommy库宏)

随着以下错误:

clojure.lang.ExceptionInfo: 
Assert failed: Can't set! local var or non-mutable field 
(or (nil? local) (and (:field local) (or (:mutable local) (:unsynchronized-mutable local) (:volatile-mutable local)))) at line 79 {:tag :cljs/analysis-error, :file nil, :line 79, :column 7} 

如何设置该属性?

回答

1

好的,哇,这似乎很奇怪。它没有工作,因为该代码是在一个core.async块里面搞砸了一切...

+1

这是一个已知的core.async错误http://dev.clojure.org/jira/browse/ASYNC-3 – dnolen

+0

这已经被固定在core.async master – dnolen

0

我认为(-> (sel1 tr :.ragslide) .-style .-height)你得到的是一个高度值,你不能用一个新值来设置它。

如果要在样式中添加高度元素,请尝试
set-style!函数。

相关问题