From b34269a6b15614162d68b801e29130988729bbb8 Mon Sep 17 00:00:00 2001 From: ustccjw <317713370@qq.com> Date: Thu, 23 Jul 2015 22:23:11 +0800 Subject: [PATCH] use es6 module import/export convert var to const fix bug fix bug fix for jshint fix import --- components/checkbox/index.jsx | 9 ++++----- components/collapse/index.jsx | 8 ++++---- components/dropdown/index.jsx | 8 +++----- components/input-number/index.jsx | 8 +++----- components/modal/confirm.jsx | 8 ++++---- components/modal/index.jsx | 8 +++----- components/pagination/index.jsx | 12 +++++------- components/progress/index.jsx | 9 ++++----- components/radio/group.jsx | 8 +++----- components/radio/index.jsx | 8 +++----- components/select/index.jsx | 8 ++++---- components/slider/index.jsx | 8 +++----- components/steps/index.jsx | 8 ++++---- components/switch/index.jsx | 8 +++----- components/table/index.jsx | 4 +--- components/tabs/index.jsx | 8 ++++---- components/tooltip/index.jsx | 6 +++--- 17 files changed, 58 insertions(+), 78 deletions(-) diff --git a/components/checkbox/index.jsx b/components/checkbox/index.jsx index 0b63337d12..620d2999cc 100644 --- a/components/checkbox/index.jsx +++ b/components/checkbox/index.jsx @@ -1,11 +1,10 @@ -var Checkbox = require('rc-checkbox'); -var React = require('react'); -var AntCheckbox = React.createClass({ +import Checkbox from 'rc-checkbox'; +import React from 'react'; + +export default React.createClass({ getDefaultProps() { return {prefixCls: 'ant-checkbox'}; }, render() { return ; } }); - -module.exports = AntCheckbox; diff --git a/components/collapse/index.jsx b/components/collapse/index.jsx index 7b4d0f9946..e0c95dedcc 100644 --- a/components/collapse/index.jsx +++ b/components/collapse/index.jsx @@ -1,6 +1,6 @@ -var Collapse = require('rc-collapse'); -var React = require('react'); -var prefixCls = 'ant-collapse'; +import Collapse from 'rc-collapse'; +import React from 'react'; +const prefixCls = 'ant-collapse'; class AntCollapse extends React.Component { render() { @@ -14,4 +14,4 @@ AntCollapse.defaultProps = { AntCollapse.Panel = Collapse.Panel; -module.exports = AntCollapse; +export default AntCollapse; diff --git a/components/dropdown/index.jsx b/components/dropdown/index.jsx index 5c7ae02056..e2f24cdcd4 100644 --- a/components/dropdown/index.jsx +++ b/components/dropdown/index.jsx @@ -1,7 +1,7 @@ -var React = require('react'); -var Dropdown = require('rc-dropdown'); +import React from 'react'; +import Dropdown from 'rc-dropdown'; -var AntDropdown = React.createClass({ +export default React.createClass({ getDefaultProps: function () { return { transitionName: 'slide-up', @@ -14,5 +14,3 @@ var AntDropdown = React.createClass({ ); } }); - -module.exports = AntDropdown; diff --git a/components/input-number/index.jsx b/components/input-number/index.jsx index 265d828237..3407e28d8c 100644 --- a/components/input-number/index.jsx +++ b/components/input-number/index.jsx @@ -1,7 +1,7 @@ -var InputNumber = require('rc-input-number'); -var React = require('react'); +import InputNumber from 'rc-input-number'; +import React from 'react'; -var AntInputNumber = React.createClass({ +export default React.createClass({ getDefaultProps() { return { prefixCls: 'ant-input-number' @@ -11,5 +11,3 @@ var AntInputNumber = React.createClass({ return ; } }); - -module.exports = AntInputNumber; diff --git a/components/modal/confirm.jsx b/components/modal/confirm.jsx index 1c19a61a9a..1242a4ca9c 100644 --- a/components/modal/confirm.jsx +++ b/components/modal/confirm.jsx @@ -1,8 +1,8 @@ -var React = require('react'); -var Dialog = require('rc-dialog'); +import React from 'react'; +import Dialog from 'rc-dialog'; var div; -module.exports = function (props) { +export default function (props) { var d; props = props || {}; props.iconClassName = props.iconClassName || 'anticon-exclamation-circle'; @@ -82,4 +82,4 @@ module.exports = function (props) { , div, function () { d = this; }); -}; +} diff --git a/components/modal/index.jsx b/components/modal/index.jsx index 42d3da1233..eabbde5b13 100644 --- a/components/modal/index.jsx +++ b/components/modal/index.jsx @@ -1,9 +1,9 @@ -var React = require('react'); -var Dialog = require('rc-dialog'); +import React from 'react'; +import Dialog from 'rc-dialog'; function noop() { } -var Modal = React.createClass({ +export default React.createClass({ getInitialState() { return { visible: false, @@ -57,5 +57,3 @@ var Modal = React.createClass({ return ; } }); - -module.exports = Modal; diff --git a/components/pagination/index.jsx b/components/pagination/index.jsx index 9dbd29be22..1d83308545 100644 --- a/components/pagination/index.jsx +++ b/components/pagination/index.jsx @@ -1,10 +1,10 @@ -let React = require('react'); -let Pagination = require('rc-pagination'); -let Select = require('rc-select'); +import React from 'react'; +import Pagination from 'rc-pagination'; +import Select from 'rc-select'; -let prefixCls = 'ant-pagination'; +const prefixCls = 'ant-pagination'; -class AntPagination extends React.Component { +export default class AntPagination extends React.Component { render() { return ; } } - -module.exports = AntPagination; diff --git a/components/progress/index.jsx b/components/progress/index.jsx index 676c023d52..1c380a8fcd 100644 --- a/components/progress/index.jsx +++ b/components/progress/index.jsx @@ -1,7 +1,6 @@ -var Progressline = require('rc-progress').Line; -var Progresscircle = require('rc-progress').Circle; -var React = require('react'); -var assign = require('object-assign'); +import {Line as Progressline, Circle as Progresscircle} from 'rc-progress'; +import React from 'react'; +import assign from 'object-assign'; var Line = React.createClass({ getDefaultProps() { @@ -129,7 +128,7 @@ var Circle = React.createClass({ } }); -module.exports = { +export default { Line: Line, Circle: Circle }; diff --git a/components/radio/group.jsx b/components/radio/group.jsx index 5f43e478a1..f544f10db1 100644 --- a/components/radio/group.jsx +++ b/components/radio/group.jsx @@ -1,5 +1,5 @@ -var React = require('react'); -var Radio = require('./index'); +import React from 'react'; +import Radio from './index'; function getCheckedValue(children) { var checkedValue = null; @@ -11,7 +11,7 @@ function getCheckedValue(children) { return checkedValue; } -var AntRadioGroup = React.createClass({ +export default React.createClass({ getDefaultProps: function () { return { prefixCls: 'ant-radio-group', @@ -58,5 +58,3 @@ var AntRadioGroup = React.createClass({ this.props.onChange(ev); } }); - -module.exports = AntRadioGroup; diff --git a/components/radio/index.jsx b/components/radio/index.jsx index 1f06a282a3..0b77c2ae56 100644 --- a/components/radio/index.jsx +++ b/components/radio/index.jsx @@ -1,7 +1,7 @@ -var Radio = require('rc-radio'); -var React = require('react'); +import Radio from 'rc-radio'; +import React from 'react'; -var AntRadio = React.createClass({ +export default React.createClass({ getDefaultProps() { return { prefixCls: 'ant-radio' @@ -16,5 +16,3 @@ var AntRadio = React.createClass({ ); } }); - -module.exports = AntRadio; diff --git a/components/select/index.jsx b/components/select/index.jsx index db737db9a9..dad235583a 100644 --- a/components/select/index.jsx +++ b/components/select/index.jsx @@ -1,7 +1,7 @@ -var React = require('react'); -var Select = require('rc-select'); +import React from 'react'; +import Select from 'rc-select'; -module.exports = React.createClass({ +export default React.createClass({ getDefaultProps: function () { return { prefixCls: 'ant-select', @@ -17,4 +17,4 @@ module.exports = React.createClass({ } }); -module.exports.Option = Select.Option; +export const Option = Select.Option; diff --git a/components/slider/index.jsx b/components/slider/index.jsx index 73f9da7107..a3be9bca4a 100644 --- a/components/slider/index.jsx +++ b/components/slider/index.jsx @@ -1,7 +1,7 @@ -var React = require('react'); -var Slider = require('rc-slider'); +import React from 'react'; +import Slider from 'rc-slider'; -var AntSlider = React.createClass({ +export default React.createClass({ getDefaultProps() { return { prefixCls: 'ant-slider' @@ -11,5 +11,3 @@ var AntSlider = React.createClass({ return ; } }); - -module.exports = AntSlider; diff --git a/components/steps/index.jsx b/components/steps/index.jsx index f83b50af50..823fe66e59 100644 --- a/components/steps/index.jsx +++ b/components/steps/index.jsx @@ -1,7 +1,7 @@ -var React = require('react'); -var Steps = require('rc-steps'); +import React from 'react'; +import Steps from 'rc-steps'; -var AntSteps = React.createClass({ +const AntSteps = React.createClass({ getDefaultProps() { return { prefixCls: 'ant-steps', @@ -21,4 +21,4 @@ var AntSteps = React.createClass({ }); AntSteps.Step = Steps.Step; -module.exports = AntSteps; +export default AntSteps; diff --git a/components/switch/index.jsx b/components/switch/index.jsx index b4e8f54d99..1e134a12b4 100644 --- a/components/switch/index.jsx +++ b/components/switch/index.jsx @@ -1,7 +1,7 @@ -var Switch = require('rc-switch'); -var React = require('react'); +import Switch from 'rc-switch'; +import React from 'react'; -var AntSwitch = React.createClass({ +export default React.createClass({ getDefaultProps() { return { prefixCls: 'ant-switch' @@ -11,5 +11,3 @@ var AntSwitch = React.createClass({ return ; } }); - -module.exports = AntSwitch; diff --git a/components/table/index.jsx b/components/table/index.jsx index a73d97764b..00fafac0af 100644 --- a/components/table/index.jsx +++ b/components/table/index.jsx @@ -7,7 +7,7 @@ import FilterMenu from './filterMenu'; import Pagination from '../pagination'; import objectAssign from 'object-assign'; -let AntTable = React.createClass({ +export default React.createClass({ getInitialState() { // 支持两种模式 if (Array.isArray(this.props.dataSource)) { @@ -340,5 +340,3 @@ let AntTable = React.createClass({ ; } }); - -export default AntTable; diff --git a/components/tabs/index.jsx b/components/tabs/index.jsx index b1d3df6193..5686353d59 100644 --- a/components/tabs/index.jsx +++ b/components/tabs/index.jsx @@ -1,6 +1,6 @@ -var Tabs = require('rc-tabs'); -var React = require('react'); -var prefixCls = 'ant-tabs'; +import Tabs from 'rc-tabs'; +import React from 'react'; +const prefixCls = 'ant-tabs'; class AntTabs extends React.Component { render() { @@ -19,4 +19,4 @@ AntTabs.defaultProps = { AntTabs.TabPane = Tabs.TabPane; -module.exports = AntTabs; +export default AntTabs; diff --git a/components/tooltip/index.jsx b/components/tooltip/index.jsx index b7881f9ca2..1b8ee09cec 100644 --- a/components/tooltip/index.jsx +++ b/components/tooltip/index.jsx @@ -1,7 +1,7 @@ -var React = require('react'); -var Tooltip = require('rc-tooltip'); +import React from 'react'; +import Tooltip from 'rc-tooltip'; -module.exports = React.createClass({ +export default React.createClass({ getDefaultProps() { return { placement: 'top'