提交 31ef99c8 编写于 作者: A afc163

debug mode

上级 084660e5
......@@ -8,6 +8,6 @@
var Datepicker = antd.datepicker;
React.render(
<Datepicker />
<Datepicker value="2015-01-01" />
, document.getElementById('components-datepicker-demo-basic'));
````
# 日期格式
- description: 自定义您需要的日期定义格式:yyyy/MM/dd
---
````jsx
var Datepicker = antd.datepicker;
React.render(
<Datepicker format="yyyy/MM/dd" />
, document.getElementById('components-datepicker-demo-formatter'));
````
......@@ -5,6 +5,7 @@ var DatePicker = Calendar.Picker;
var GregorianCalendar = require('gregorian-calendar');
var zhCn = require('gregorian-calendar/lib/locale/zh-cn');
var CalendarLocale = require('rc-calendar/lib/locale/zh-cn');
var DateTimeFormat = require('gregorian-calendar-format');
module.exports = React.createClass({
getInitialState: function () {
......@@ -16,8 +17,14 @@ module.exports = React.createClass({
value: value
};
},
getDefaultProps: function () {
return {
format: 'yyyy-MM-dd'
};
},
render: function () {
var state = this.state;
var formatter = new DateTimeFormat(this.props.format);
var calendar = (
<Calendar
locale={CalendarLocale}
......@@ -26,8 +33,7 @@ module.exports = React.createClass({
);
return (
<DatePicker
trigger={<span className="datepicker-icon" />}
formatter={this.props.formatter} calendar={calendar}
formatter={formatter} calendar={calendar}
value={this.state.value} onChange={this.handleChange}>
<input type="text" className="datepicker-input" />
</DatePicker>
......
window.antd = {
var antd = {
datepicker: require('./components/datepicker')
};
module.exports = antd;
window.antd = antd;
var path = require('path');
var webpackMiddleware = require("webpack-dev-middleware");
var webpack = require('webpack');
// {{ settings for nico
exports.site = {
......@@ -26,4 +28,29 @@ exports.writers = [
'nico-jsx.StaticWriter',
'nico-jsx.FileWriter'
];
exports.middlewares = [{
name: 'webpack',
filter: /index\.js/,
handle: webpackMiddleware(webpack(require('./webpack.config')), {
// all options optional
noInfo: false,
// display no info to console (only warnings and errors)
watchDelay: 300,
// delay after change (only lazy: false)
publicPath: "/dist/",
// public path to bind the middleware to
// use the same as in webpack
headers: { "X-Custom-Header": "yes" },
// custom headers
stats: {
colors: true
}
// options for formating the statistics
})
}];
// end settings }}
......@@ -12,6 +12,7 @@
},
"dependencies": {
"gregorian-calendar": "~3.0.0",
"gregorian-calendar-format": "~3.0.1",
"rc-calendar": "~3.3.0"
},
"devDependencies": {
......@@ -22,7 +23,8 @@
"lodash": "~3.8.0",
"nico-jsx": "~0.5.3",
"style-loader": "~0.12.2",
"webpack": "~1.9.7"
"webpack": "~1.9.7",
"webpack-dev-middleware": "~1.0.11"
},
"scripts": {
"build": "npm run clean && nico build",
......
var webpack = require('webpack');
var path = require('path');
module.exports = {
entry: './index.js',
......@@ -8,7 +9,7 @@ module.exports = {
},
output: {
path: 'dist',
path: path.join(process.cwd(), 'dist'),
filename: 'index.js'
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册