From 9838869517e9d650d8a2d5966acee0a61f8d62ee Mon Sep 17 00:00:00 2001 From: zuiidea Date: Wed, 27 Jan 2016 16:56:51 +0800 Subject: [PATCH] admin-demo --- admin/index.html | 18 ++++++++++++++++++ admin/user.html | 18 ++++++++++++++++++ index.html | 7 +++++-- package.json | 12 ++++++++++-- pages/index.html | 18 ++++++++++++++++++ pages/user.html | 18 ++++++++++++++++++ src/component/App.jsx | 4 ++-- src/entry/admin/index.jsx | 12 ++++++++++++ src/entry/admin/user.jsx | 12 ++++++++++++ webpack.config.js | 6 ++++++ 10 files changed, 119 insertions(+), 6 deletions(-) create mode 100644 admin/index.html create mode 100644 admin/user.html create mode 100644 pages/index.html create mode 100644 pages/user.html create mode 100644 src/entry/admin/index.jsx create mode 100644 src/entry/admin/user.jsx diff --git a/admin/index.html b/admin/index.html new file mode 100644 index 0000000..2b37c3b --- /dev/null +++ b/admin/index.html @@ -0,0 +1,18 @@ + + + + + + + + + +
+ +
+ + + + diff --git a/admin/user.html b/admin/user.html new file mode 100644 index 0000000..edcf13f --- /dev/null +++ b/admin/user.html @@ -0,0 +1,18 @@ + + + + + + + + + +
+ +
+ + + + diff --git a/index.html b/index.html index bdb0c5d..50206ad 100644 --- a/index.html +++ b/index.html @@ -3,13 +3,16 @@ - + -
+
+ +
+ diff --git a/package.json b/package.json index 441239d..4555c70 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,15 @@ "name": "antd-demo", "version": "1.0.0", "entry": { - "index": "./src/entry/index.jsx" + "index": "./src/entry/index.jsx", + "admin/index": ["./src/entry/admin/index.jsx"], + "admin/user": ["./src/entry/admin/user.jsx"] }, + "output": { + "path": "dist", + "filename": "index_bundle.js" + }, + "plugins": "[new HtmlWebpackPlugin()]", "dependencies": { "antd": "0.11.x", "atool-build": "0.4.x", @@ -20,6 +27,7 @@ "eslint": "~1.10.3", "eslint-config-airbnb": "~2.1.0", "eslint-plugin-react": "~3.11.3", + "html-webpack-plugin": "^2.7.2", "pre-commit": "1.x" }, "pre-commit": [ @@ -28,6 +36,6 @@ "scripts": { "dev": "dora -p 8001 --plugins atool-build,proxy,hmr", "lint": "eslint --ext .js,.jsx src", - "build": "atool-build -o ./dist/${npm_package_family}/${npm_package_name/{npm_package_version}" + "build": "atool-build -o ./dist" } } diff --git a/pages/index.html b/pages/index.html new file mode 100644 index 0000000..15b3303 --- /dev/null +++ b/pages/index.html @@ -0,0 +1,18 @@ + + + + + + + + + +
+ +
+ + + + diff --git a/pages/user.html b/pages/user.html new file mode 100644 index 0000000..be4482d --- /dev/null +++ b/pages/user.html @@ -0,0 +1,18 @@ + + + + + + + + + +
+ +
+ + + + diff --git a/src/component/App.jsx b/src/component/App.jsx index 0762ecf..0a37080 100644 --- a/src/component/App.jsx +++ b/src/component/App.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { DatePicker, message } from 'antd'; +import { DatePicker , message , Button , Menu, Dropdown, Icon } from 'antd'; const App = React.createClass({ getInitialState() { @@ -21,4 +21,4 @@ const App = React.createClass({ } }); -export default App; \ No newline at end of file +export default App; diff --git a/src/entry/admin/index.jsx b/src/entry/admin/index.jsx new file mode 100644 index 0000000..7682e54 --- /dev/null +++ b/src/entry/admin/index.jsx @@ -0,0 +1,12 @@ +import '../../common/lib'; +import { Button ,Switch ,Icon} from 'antd'; +import ReactDOM from 'react-dom'; +import React from 'react'; + +function onChange(checked){ + console.log('switch to ' + checked); +} + +ReactDOM.render(
+} unCheckedChildren={} /> +
, document.getElementById('react-content')); diff --git a/src/entry/admin/user.jsx b/src/entry/admin/user.jsx new file mode 100644 index 0000000..1bbba4a --- /dev/null +++ b/src/entry/admin/user.jsx @@ -0,0 +1,12 @@ +import '../../common/lib'; +import { Button ,Switch ,Icon} from 'antd'; +import ReactDOM from 'react-dom'; +import React from 'react'; + +function onChange(checked){ + console.log('switch to ' + checked); +} + +ReactDOM.render(
+} unCheckedChildren={} /> +
, document.getElementById('react-content')); diff --git a/webpack.config.js b/webpack.config.js index 16a1d16..4a8567b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,10 @@ +// require('./admin/index.html'); + module.exports = function(webpackConfig) { + webpackConfig.module.loaders.push({ + test: /\.html$/, + loader: 'file?name=[name].[ext]' + }); webpackConfig.module.loaders.forEach(function(loader) { if (loader.loader === 'babel') { // https://github.com/ant-design/babel-plugin-antd