Skip to content

Commit

Permalink
fixed ie8 compatibility. #2
Browse files Browse the repository at this point in the history
  • Loading branch information
aTool committed Jun 8, 2016
1 parent 72b54bb commit b40c661
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"presets": ["react", "es2015"],
"plugins": ["transform-es3-member-expression-literals", "transform-es3-property-literals"],
"env": {
"development": {
}
Expand Down
28 changes: 14 additions & 14 deletions lib/echarts-for-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ var _elementResizeEvent = require('element-resize-event');

var _elementResizeEvent2 = _interopRequireDefault(_elementResizeEvent);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var ReactEcharts = _react2.default.createClass({
var ReactEcharts = _react2['default'].createClass({
displayName: 'ReactEcharts',

propTypes: {
option: _react2.default.PropTypes.object.isRequired,
style: _react2.default.PropTypes.object,
className: _react2.default.PropTypes.string,
theme: _react2.default.PropTypes.string,
onChartReady: _react2.default.PropTypes.func,
showLoading: _react2.default.PropTypes.bool,
onEvents: _react2.default.PropTypes.object
option: _react2['default'].PropTypes.object.isRequired,
style: _react2['default'].PropTypes.object,
className: _react2['default'].PropTypes.string,
theme: _react2['default'].PropTypes.string,
onChartReady: _react2['default'].PropTypes.func,
showLoading: _react2['default'].PropTypes.bool,
onEvents: _react2['default'].PropTypes.object
},
// first add
componentDidMount: function componentDidMount() {
Expand All @@ -52,7 +52,7 @@ var ReactEcharts = _react2.default.createClass({
if (typeof this.props.onChartReady === 'function') this.props.onChartReady(echartObj);

// on resize
(0, _elementResizeEvent2.default)(this.refs.echartsDom, function () {
(0, _elementResizeEvent2['default'])(this.refs.echartsDom, function () {
echartObj.resize();
});
},
Expand All @@ -64,7 +64,7 @@ var ReactEcharts = _react2.default.createClass({

// remove
componentWillUnmount: function componentWillUnmount() {
_echarts2.default.dispose(this.refs.chart);
_echarts2['default'].dispose(this.refs.chart);
},

// render the dom
Expand All @@ -81,14 +81,14 @@ var ReactEcharts = _react2.default.createClass({
},
getEchartsInstance: function getEchartsInstance() {
// return the echart object
return _echarts2.default.getInstanceByDom(this.refs.echartsDom) || _echarts2.default.init(this.refs.echartsDom, this.props.theme);
return _echarts2['default'].getInstanceByDom(this.refs.echartsDom) || _echarts2['default'].init(this.refs.echartsDom, this.props.theme);
},
render: function render() {
var style = this.props.style || { height: '300px' };
// for render
return _react2.default.createElement('div', { ref: 'echartsDom',
return _react2['default'].createElement('div', { ref: 'echartsDom',
className: this.props.className,
style: style });
}
});
exports.default = ReactEcharts;
exports['default'] = ReactEcharts;
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
"cross-env": "^1.0.8",
"echarts": "^3.1.1",
"element-resize-event": "^2.0.5",
"react-router": "^2.0.0"
"react-router": "^2.0.0",
"babel-plugin-transform-es3-property-literals": "*",
"babel-plugin-transform-es3-member-expression-literals": "*"
},
"dependencies": {
"echarts": "^3.1.1",
Expand Down

0 comments on commit b40c661

Please sign in to comment.