UNPKG

2.07 kBJavaScriptView Raw
1import _extends from 'babel-runtime/helpers/extends';
2import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
3import _createClass from 'babel-runtime/helpers/createClass';
4import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
5import _inherits from 'babel-runtime/helpers/inherits';
6var __rest = this && this.__rest || function (s, e) {
7 var t = {};
8 for (var p in s) {
9 if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
10 }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
11 if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
12 }return t;
13};
14import classnames from 'classnames';
15import React from 'react';
16
17var Cell = function (_React$Component) {
18 _inherits(Cell, _React$Component);
19
20 function Cell() {
21 _classCallCheck(this, Cell);
22
23 //head单击事件
24 var _this = _possibleConstructorReturn(this, (Cell.__proto__ || Object.getPrototypeOf(Cell)).apply(this, arguments));
25
26 _this.handleHeaderClick = function (e) {
27 console.log(e);
28 };
29 return _this;
30 }
31
32 _createClass(Cell, [{
33 key: 'render',
34 value: function render() {
35 var _a = this.props,
36 prefixCls = _a.prefixCls,
37 className = _a.className,
38 title = _a.title,
39 restProps = __rest(_a, ["prefixCls", "className", "title"]);
40 //类名
41 var cellCls = classnames(prefixCls, className, {});
42 return React.createElement(
43 'div',
44 _extends({ className: cellCls }, restProps),
45 React.createElement(
46 'div',
47 { className: prefixCls + '-header', onClick: this.handleHeaderClick },
48 title
49 )
50 );
51 }
52 }]);
53
54 return Cell;
55}(React.Component);
56
57Cell.defaultProps = {
58 prefixCls: 'bs-cell'
59};
60export default Cell;
\No newline at end of file