如何在Hoplon中切换标签

时间:2017-10-03 23:14:52

标签: clojurescript hoplon

如果我有以下代码和功能,可以从' p'标记为' h1'标记:

 (def switch-tag (cell p))

后来在hlisp

 ((cell= switch-tag) "Text goes here")

当我切换到h1标签时,似乎没有发生任何事情。

1 个答案:

答案 0 :(得分:1)

我一直无法用你的方式解决这个问题。这是一个解决方法:

(page "index.html")

(def key! (cell true))

(defelem my-elem [_ [child]]
         (cell= (if key! (h1 child) (p child))))

(html
    (body
        (button :click #(swap! key! not) "test")
        (my-elem "this is a test")))
相关问题