我正在使用clojurescript 0.0-2371,我试图编写一些代码来克隆一个对象。我有这样的代码,我想克隆一个节点,并调用clone-object
功能:clojurescript遍历对象的键
(def animate
(js/React.createClass
#js
{:getInitialState
(fn []
(this-as this
{:children
(->
(.. this -props -children)
(js/React.Children.map (fn [child] child))
(js->clj :keywordize-keys false))}))
:render
(fn []
(this-as this
(let [children (:children (.. this -state))]
(doseq [[k v] children]
(clone-object (aget children k))))))}))
clone-object
看起来是这样的:
(defn clone-object [obj]
(log/debug obj)
(doseq [[k v] obj]
(log/debug k)))
而且如果我叫clone-object
这样的:
(doseq [[k v] children]
(clone-object v))
我收到此错误:
Uncaught Error: [object Object] is not ISeqable
为什么'key'参数? – Marcs 2016-09-22 15:37:48