这是我的应用程序的结构:
(reg-event-db
:app-surface-add-layer!
(fn [db [_ layer-content & [layer-params]]]
(assoc db :app-surface-layers
(conj (:app-surface-layers db)
{:layer-content layer-content
:layer-params layer-params}))))
(reg-sub
:app-surface-get-layers
(fn [db _]
(:app-surface-layers db)))
(defn x-app []
(let [app-surface-layers (subscribe [:app-surface-get-layers])]
(fn []
[:div#app
[:div#app-topbar "Menu-1, Menu-2, etc."]
[:div#app-sidebar "Menu-3, Menu-4, etc."]
[:div#app-surface
(reduce
(fn [app-surface layer-data]
(conj app-surface
[(:layer-content layer-data) (:layer-params layer-data)]))
[:div#app-surface-layers]
@app-surface-layers)]])))
(defn calendar [params]
[:div#calendar
"Calendar"])
; Put the calendar component to the re-frame db
(dispatch [:app-surface-add-layer! #'calendar ["Param-1"]])
我的问题是,我可以将我的应用程序的内容组件(如示例中的日历)存储在重新框架数据库中吗?您如何看待此解决方案的性能?