ClojureScript Reagent Material ui, 我想使用 CssTransitionGroups
ClojureScript Reagent Material ui, I want to use CssTransitionGroups
我在项目中使用 ClojureScript。一开始我使用 Reagent 和 Material ui 尤其是 Stepper 组件。我的问题是我想使用 CssTransitionGroups,因为我需要导入 react-with-addons。问题是两个 "libraries" 没有一起工作。这是 project.clj
(defproject ironrainbow "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.9.89"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[cljs-ajax "0.5.8"]
[org.clojure/data.json "0.2.6"]
[re-frame "0.8.0"]
[reagent "0.6.0" :exclusions [cljsjs/react]]
[cljsjs/react-with-addons "15.2.1-0"]
[cljs-react-material-ui "0.2.21"]
[cljsjs/react-motion "0.3.0-0"]
[secretary "1.2.3"]]
:plugins [[lein-cljsbuild "1.1.3"]]
:min-lein-version "2.5.3"
:source-paths ["src/clj"]
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
:figwheel {:css-dirs ["resources/public/css"]}
:profiles
{:dev
{:dependencies []
:plugins [[lein-figwheel "0.5.4-3"]]}}
:cljsbuild
{:builds
[{:id "dev"
:source-paths ["src/cljs"]
:figwheel {:on-jsload "ironrainbow.core/mount-root"}
:compiler {:main ironrainbow.core
:output-to "resources/public/js/compiled/app.js"
:output-dir "resources/public/js/compiled/out"
:asset-path "js/compiled/out"
:source-map-timestamp true}}
{:id "min"
:source-paths ["src/cljs"]
:compiler {:main ironrainbow.core
:output-to "resources/public/js/compiled/app.js"
:optimizations :advanced
:closure-defines {goog.DEBUG false}
:pretty-print false}}]})
所以使用CssTransitionGroups的第一步是定义
(def css-transition-group
(reagent/adapt-react-class js/React.addons.CSSTransitionGroup))
但是除非 Material.ui 不包括在内,否则这将不起作用。 material.ui 以某种方式覆盖了 React.addons。如果您尝试在浏览器的控制台中键入 React.addons,如果 material.ui 也是 required,您将得到未定义。他们分开工作。
我发布了 cljs-react-material-ui
和 cljsjs/material-ui
的新版本,其中包含 React 插件。您可以通过 js/React.addons
或通过库组件访问它,更多信息请参见:https://github.com/madvas/cljs-react-material-ui#react-with-addons
我在项目中使用 ClojureScript。一开始我使用 Reagent 和 Material ui 尤其是 Stepper 组件。我的问题是我想使用 CssTransitionGroups,因为我需要导入 react-with-addons。问题是两个 "libraries" 没有一起工作。这是 project.clj
(defproject ironrainbow "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.9.89"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[cljs-ajax "0.5.8"]
[org.clojure/data.json "0.2.6"]
[re-frame "0.8.0"]
[reagent "0.6.0" :exclusions [cljsjs/react]]
[cljsjs/react-with-addons "15.2.1-0"]
[cljs-react-material-ui "0.2.21"]
[cljsjs/react-motion "0.3.0-0"]
[secretary "1.2.3"]]
:plugins [[lein-cljsbuild "1.1.3"]]
:min-lein-version "2.5.3"
:source-paths ["src/clj"]
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
:figwheel {:css-dirs ["resources/public/css"]}
:profiles
{:dev
{:dependencies []
:plugins [[lein-figwheel "0.5.4-3"]]}}
:cljsbuild
{:builds
[{:id "dev"
:source-paths ["src/cljs"]
:figwheel {:on-jsload "ironrainbow.core/mount-root"}
:compiler {:main ironrainbow.core
:output-to "resources/public/js/compiled/app.js"
:output-dir "resources/public/js/compiled/out"
:asset-path "js/compiled/out"
:source-map-timestamp true}}
{:id "min"
:source-paths ["src/cljs"]
:compiler {:main ironrainbow.core
:output-to "resources/public/js/compiled/app.js"
:optimizations :advanced
:closure-defines {goog.DEBUG false}
:pretty-print false}}]})
所以使用CssTransitionGroups的第一步是定义
(def css-transition-group
(reagent/adapt-react-class js/React.addons.CSSTransitionGroup))
但是除非 Material.ui 不包括在内,否则这将不起作用。 material.ui 以某种方式覆盖了 React.addons。如果您尝试在浏览器的控制台中键入 React.addons,如果 material.ui 也是 required,您将得到未定义。他们分开工作。
我发布了 cljs-react-material-ui
和 cljsjs/material-ui
的新版本,其中包含 React 插件。您可以通过 js/React.addons
或通过库组件访问它,更多信息请参见:https://github.com/madvas/cljs-react-material-ui#react-with-addons