var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * @author lvzhiyi
 *
 * @description img加载组件
 */
import React, { Component } from 'react';
import './style.styl';
var Img = /** @class */ (function (_super) {
    __extends(Img, _super);
    function Img(props) {
        var _this = _super.call(this, props) || this;
        _this.state = {
            error: false
        };
        return _this;
    }
    Img.prototype.render = function () {
        var _this = this;
        var _a = this.props, src = _a.src, place = _a.place;
        return this.state.error && !place ? (<div className="instead-img"/>) : (<img className="img-load" src={src && !this.state.error ? src : place} onError={function () {
            _this.setState({ error: true });
        }} alt=""/>);
    };
    return Img;
}(Component));
export default Img;
