小编Nyo*_*kti的帖子

clojurescript /试剂的功能不起作用

我最近使用试剂和重新框架为我的clojurescript项目,我有一个问题:所以我有html自定义标签

<question id="1"></question>
<question id="2"></question>
Run Code Online (Sandbox Code Playgroud)

我想用cljs函数将它们交换到我的试剂生成的html中

(defn mypanel []
 [:p "Hi!"])

(let [q (.getElementsByTagName js/document "question")]
  (for [i (range 2)]
    ^{:keys i}
    (reagent/render [mypanel]
                  (aget (.getElementsByTagName js/document "question") i))))
Run Code Online (Sandbox Code Playgroud)

但它不起作用,我试图测试它而不使用for函数

(reagent/render [mypanel]
     (aget (.getElementsByTagName js/document "question") 0))
Run Code Online (Sandbox Code Playgroud)

只用一个标签就可以了.

而且我不知道为什么for功能不起作用,或者试剂不能这样工作?有人有建议吗?

我非常喜欢这个.

clojure clojurescript reagent re-frame

2
推荐指数
1
解决办法
199
查看次数

标签 统计

clojure ×1

clojurescript ×1

re-frame ×1

reagent ×1