UNPKG

micro-ui-y

Version:

123 lines (92 loc) 5.13 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _dialog = require('../dialog/dialog'); var _dialog2 = _interopRequireDefault(_dialog); var _scrollBox = require('../scroll/scrollBox2.0'); var _scrollBox2 = _interopRequireDefault(_scrollBox); var _button = require('../button/button'); var _button2 = _interopRequireDefault(_button); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // import { zIndex } from 'material-ui/styles'; var PreviewImage = function (_Component) { _inherits(PreviewImage, _Component); function PreviewImage() { _classCallCheck(this, PreviewImage); var _this = _possibleConstructorReturn(this, (PreviewImage.__proto__ || Object.getPrototypeOf(PreviewImage)).call(this)); _this.clickImg = function () { _this.setState({ open: true }); }; _this.handleClose = function () { _this.setState({ open: false }); }; _this.componentDidMount = function () { if (_this.props.open == true) { _this.setState({ open: true }); } }; _this.state = { open: false }; return _this; } //图片点击放大方法 //关闭dialog _createClass(PreviewImage, [{ key: 'render', value: function render() { var props = _objectWithoutProperties(this.props, []); // const zIndex = props.zIndex?props.zIndex:""; var contentStyle = { minWidth: "90rem", maxWidth: '120rem', height: "50rem" }; var bodyStyle = { width: '100%' }; var actions = [_react2.default.createElement(_button2.default, { scenesType: 'back', btnText: '\u8FD4\u56DE', handleBtn: this.handleClose })]; return _react2.default.createElement( 'div', null, _react2.default.createElement('img', { src: props.src, onClick: this.clickImg, style: { width: props.width || "4rem", height: props.height || "4rem" } }), _react2.default.createElement( _dialog2.default, { open: this.state.open, handleClose: this.handleClose, contentStyle: contentStyle, bodyStyle: bodyStyle, actions: actions // zIndex={zIndex} }, _react2.default.createElement( _scrollBox2.default, { maxHeight: '40rem', scrollBarColor: '#cccccc', autohide: true }, _react2.default.createElement( 'div', null, _react2.default.createElement('img', { style: { width: "100%" }, src: props.src }) ) ) ) ); } }]); return PreviewImage; }(_react.Component); exports.default = PreviewImage; //# sourceMappingURL=previewImage.js.map