我無法獲得reagent-forms
以綁定到原子。我有數據綁定工作在其他地方在同一個文件中的試劑。我可以按照預期設置和顯示有問題的原子。試劑形式綁定字段忽略':字段',缺少依賴或不正確的用法?
我有
form-doc
一個返回[:div]
矢量與我想束縛form-test
創建的原子,並呼籲/#/test
定義bind-forms
secretary
路徑輸入這似乎是關鍵wi的:field
薄的form-doc
返回值被忽略或不被bind-fields.
解析在下面的試驗例中,日期選擇器從不顯示和輸入看起來比沒有[:input ]
不同會。
我使用reagent-forms
錯誤嗎?缺少js依賴項?在core.cljs
(ns ...
(:require
...
[reagent.core :as reagent :refer [atom]]
[reagent.session :as session]
[secretary.core :as secretary :include-macros true]
[reagent-forms.core :as rf ]
[json-html.core :refer [edn->hiccup]]
))
(defn form-doc []
[:div
[:input {:field :text :id :foobar}]
[:input {:field :text :id :test}]
[:div {:field :datepicker
:id :picker
:date-format "yyyy/mm/dd"
:inline true}]
]
)
(defn form-test []
(let [doc (atom {:test "test"}) ]
(fn []
[:div.new-visit-form
[rf/bind-fields form-doc doc ]
[:div (edn->hiccup @doc) ]
]))
)
(secretary/defroute "/test" []
(session/put! :current-page #'form-test))
中環/的Compojure處理器的localhost.localdomain:3000/#/test
<div data-reactid=".5.0.0">
<input id="foobar" data-reactid=".5.0.0.0">
<input id="test" data-reactid=".5.0.0.1">
<input id="nofieldtest" data-reactid=".5.0.0.2">
<div id="picker" data-reactid=".5.0.0.3"></div>
</div>
瀏覽器呈現的HTML我有
(include-js "//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js")
(include-js "//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js")
(include-css "//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css")
(include-css "//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css")
[:style (-> "reagent-forms.css" clojure.java.io/resource slurp) ]
,據我所知,人升必要js和css是由瀏覽器
在project.clj
的加載:dependencies
[reagent "0.5.1"]
[reagent-utils "0.1.5"]
[reagent-forms "0.5.13"]