shineout
Version:
Shein 前端组件库
54 lines (45 loc) • 1.57 kB
JavaScript
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React, { PureComponent } from 'react';
import { getDirectionClass } from '../utils/classname';
import { paginationClass } from './styles';
var DefaultValue = {
disabled: false,
isCurrent: false
};
var Item =
/*#__PURE__*/
function (_PureComponent) {
_inheritsLoose(Item, _PureComponent);
function Item(props) {
var _this;
_this = _PureComponent.call(this, props) || this;
_this.handleClick = _this.handleClick.bind(_assertThisInitialized(_assertThisInitialized(_this)));
return _this;
}
var _proto = Item.prototype;
_proto.handleClick = function handleClick() {
var _this$props = this.props,
page = _this$props.page,
onClick = _this$props.onClick;
onClick(page);
};
_proto.render = function render() {
var _this$props2 = this.props,
children = _this$props2.children,
isCurrent = _this$props2.isCurrent,
disabled = _this$props2.disabled;
var className = paginationClass(getDirectionClass('item'), this.props.className, isCurrent && 'current');
return (// @ts-ignore
React.createElement("a", {
className: className,
disabled: disabled || isCurrent,
onClick: this.handleClick
}, children)
);
};
return Item;
}(PureComponent);
_defineProperty(Item, "defaultProps", DefaultValue);
export default Item;