12345678910111213141516171819202122232425262728293031323334353637383940 |
- import React, { Component } from 'react';
- import './index.less';
- import { Icon } from 'antd';
- import CheckboxItem from '../CheckboxItem';
- import { Button } from '../Button';
- export default class UserAction extends Component {
- onAction(key) {
- const { onAction } = this.props;
- if (onAction) onAction(key);
- }
- onAll(checked) {
- const { onAll } = this.props;
- if (onAll) onAll(checked);
- }
- render() {
- const { allCheckbox, help, btnList = [], right } = this.props;
- return (
- <div className="user-action">
- {allCheckbox && (
- <div className="all">
- <CheckboxItem theme="white" onClick={value => this.onAll(value)} />
- 全选
- </div>
- )}
- {btnList.map(btn => {
- return (
- <Button radius size="small" onClick={() => this.onAction(btn.key)}>
- {btn.title}
- </Button>
- );
- })}
- {help && <Icon type="question-circle" theme="filled" onClick={() => this.onAction('help')} />}
- {right && <div className="right">{right}</div>}
- </div>
- );
- }
- }
|