ant-demo
This commit is contained in:
zuiidea
2016-01-25 15:45:58 +08:00
commit c42024fbed
11 changed files with 178 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "eslint-config-airbnb"
}
+17
View File
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
+20
View File
@@ -0,0 +1,20 @@
*.iml
.idea/
.ipr
.iws
*~
~*
*.diff
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn/
*.swp
*.swo
*.pyc
*.pyo
node_modules
dist
+25
View File
@@ -0,0 +1,25 @@
# antd-demo
## Environment
```
node >= 4
```
## Code Style
https://github.com/airbnb/javascript
## Develop
```
npm run dev
```
访问 http://127.0.0.1:8989
## Build
```
npm run build
```
+16
View File
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" type="text/css" href="./index.css"/>
<!--[if lt IE 10]>
<script src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,es5-shim/4.1.14/es5-shim.min.js,es5-shim/4.1.14/es5-sham.min.js,html5shiv/3.7.2/html5shiv.min.js,media-match/2.0.2/media.match.min.js"></script>
<![endif]-->
</head>
<body>
<div id="react-content"></div>
</body>
<script src="./common.js"></script>
<script src="./index.js"></script>
</html>
+33
View File
@@ -0,0 +1,33 @@
{
"name": "antd-demo",
"version": "1.0.0",
"entry": {
"index": "./src/entry/index.jsx"
},
"dependencies": {
"antd": "0.11.x",
"atool-build": "0.4.x",
"babel-plugin-antd": "^0.1.2",
"es3ify-loader": "^0.1.0",
"react": "~0.14.3",
"react-dom": "~0.14.3"
},
"devDependencies": {
"dora": "0.2.x",
"dora-plugin-atool-build": "0.4.x",
"dora-plugin-hmr": "0.3.x",
"dora-plugin-proxy": "0.5.x",
"eslint": "~1.10.3",
"eslint-config-airbnb": "~2.1.0",
"eslint-plugin-react": "~3.11.3",
"pre-commit": "1.x"
},
"pre-commit": [
"lint"
],
"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}"
}
}
+1
View File
@@ -0,0 +1 @@
import 'antd/lib/index.css';
+24
View File
@@ -0,0 +1,24 @@
import React from 'react';
import { DatePicker, message } from 'antd';
const App = React.createClass({
getInitialState() {
return {
date: ''
};
},
handleChange(value) {
message.info('您选择的日期是: ' + value.toString());
this.setState({
date: value
});
},
render() {
return <div style={{width: 400, margin: '100px auto'}}>
<DatePicker onChange={this.handleChange} />
<div style={{marginTop: 20}}>当前日期{this.state.date.toString()}</div>
</div>;
}
});
export default App;
+6
View File
@@ -0,0 +1,6 @@
import '../common/lib';
import App from '../component/App';
import ReactDOM from 'react-dom';
import React from 'react';
ReactDOM.render(<App />, document.getElementById('react-content'));
+17
View File
@@ -0,0 +1,17 @@
module.exports = function(webpackConfig) {
webpackConfig.module.loaders.forEach(function(loader) {
if (loader.loader === 'babel') {
// https://github.com/ant-design/babel-plugin-antd
loader.query.plugins.push('antd');
}
return loader;
});
// Fix ie8 compatibility
webpackConfig.module.loaders.unshift({
test: /\.jsx?$/,
loader: 'es3ify',
});
return webpackConfig;
};