0
我有一個關於條件和Hoplon的問題。當我嘗試:Clojurescript與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%"})))
而這一次的作品,即使周視圖的值發生了變化。
(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%"})))
我真的不知道是怎麼回事,但我只是想在「周視圖」設置爲「Y」,以獲得真正有條件的積極。我嘗試過布爾運算,但似乎沒有工作,還有很多其他的東西。
乾杯, 馬特
您也可以考慮包裝既'復位!'的'dosync'調用。這會導致重置作爲單個「交易」一起發生。它現在不一定修復任何錯誤,但會讓你的代碼更容易思考。 –