Clojurescript 中带有 Hoplon 和单元格的条件语句不起作用
Conditional statements in Clojurescript with Hoplon and cells not working
我有一个关于条件句和 Hoplon 的问题。当我尝试时:
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(if (= "y" "y")
(reset! mon-width {:width "0%"})))
它将 CSS 宽度 属性 更改为 0,但是,如果我尝试以任何方式使用单元格,它似乎不起作用。 IE.
(def week-view (cell "y"))
(def mon-width (cell {:width "50.333%"}))
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(if (= "y" (cell= week-view))
(reset! mon-width {:width "0%"})))
或:
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(if (= "y" (str (cell= week-view)))
(reset! mon-width {:width "0%"})))
或:
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(when (= "y" (str (cell= week-view)))
(reset! mon-width {:width "0%"})))
或:
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(when (= (cell= "y") (cell= week-view))
(reset! mon-width {:width "0%"})))
即使 week-view 的值发生变化,这个也能正常工作。
(def week-view (cell "n"))
(def mon-width (cell {:width "50.333%"}))
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(when (= (str (cell= "y")) (str (cell= week-view)))
(reset! mon-width {:width "0%"})))
我真的不知道发生了什么,但我只是想在 'week-view' 设置为 "y" 时激活真正的条件。我尝试了布尔值,但似乎没有用,还有很多其他东西。
干杯,
马特
我想我明白了。您可以使用 @ 符号来获取单元格的值。这是有效的新代码。
(def week-view (cell nil))
(def mon-width (cell {:width "8.333%"}))
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(when (= nil @week-view)
(reset! mon-width {:width "30%"})))
干杯,
马特
我有一个关于条件句和 Hoplon 的问题。当我尝试时:
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(if (= "y" "y")
(reset! mon-width {:width "0%"})))
它将 CSS 宽度 属性 更改为 0,但是,如果我尝试以任何方式使用单元格,它似乎不起作用。 IE.
(def week-view (cell "y"))
(def mon-width (cell {:width "50.333%"}))
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(if (= "y" (cell= week-view))
(reset! mon-width {:width "0%"})))
或:
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(if (= "y" (str (cell= week-view)))
(reset! mon-width {:width "0%"})))
或:
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(when (= "y" (str (cell= week-view)))
(reset! mon-width {:width "0%"})))
或:
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(when (= (cell= "y") (cell= week-view))
(reset! mon-width {:width "0%"})))
即使 week-view 的值发生变化,这个也能正常工作。
(def week-view (cell "n"))
(def mon-width (cell {:width "50.333%"}))
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(when (= (str (cell= "y")) (str (cell= week-view)))
(reset! mon-width {:width "0%"})))
我真的不知道发生了什么,但我只是想在 'week-view' 设置为 "y" 时激活真正的条件。我尝试了布尔值,但似乎没有用,还有很多其他东西。
干杯, 马特
我想我明白了。您可以使用 @ 符号来获取单元格的值。这是有效的新代码。
(def week-view (cell nil))
(def mon-width (cell {:width "8.333%"}))
(defn mouse-enter
[temp stuff]
(reset! temp @stuff)
(when (= nil @week-view)
(reset! mon-width {:width "30%"})))
干杯, 马特