我正在使用 reframe 处理文本输入,如下所示:
[:input {
:type "text"
:value @(subscribe [:text-bar])
:on-change
#(dispatch [:text-bar-input (-> % .-target .-value)])
}]
;; event
(reg-event-db
:text-bar-input
(fn [db [_ input-value]]
(if-not (empty? input-value)
(assoc db :text-bar input-value)
(assoc db :text-bar input-value))))
;; sub
(reg-sub
:text-bar
(fn [db]
(:text-bar db)))
但是在输入文本时,当按下一个键时,我会得到以下信息,例如键“p”:
[Error] Error: No matching clause: p
(anonymous function) (router.js:624)
re_frame$router$_exception (router.js:192)
(anonymous function) (router.js:448)
(anonymous function) (router.js:514)
re_frame$router$_fsm_trigger (router.js:97)
(anonymous function) (router.js:550)
re_frame$router$_process_1st_event_in_queue (router.js:135)
(anonymous function) (router.js:291)
re_frame$router$_run_queue (router.js:173)
(anonymous function) (router.js:472)
(anonymous function) (router.js:514)
re_frame$router$_fsm_trigger (router.js:97)
(anonymous function) (router.js:336)
(anonymous function) (nexttick.js:211)
我究竟做错了什么?