我有两个试剂组件,它们将显示在我的 Web 应用程序的不同页面上。经过单独测试,它们都完全按照应有的方式工作。当我尝试渲染它们时,只显示一个。
这是clojurescript:
(defn mount-components []
(r/render [#'password-component] (.getElementById js/document "password"))
(r/render [#'test-component] (.getElementById js/document "test")))
(defn init! []
(mount-components))
在后端我有这个:
(defn password-page []
(layout/base
[:h1 "Change your password"]
[:div#password]))
(defn home-page []
(layout/base
[:h1 "Hello!"]
[:div#test]))
(defroutes app-routes
(GET "/" [] home-page)
(get "/password" [] password-page))
在我编译 clojurescript 并查看页面后,只显示密码组件。如果我在函数中交换顺序mount-components
,那么test-component
首先,只test-component
显示而不是password-component
.
如何同时显示两个组件?