react-admin-lte
Version:
简单封装的 AdminLTE react 类库,并包含一个编译配置。
42 lines (35 loc) • 942 B
JavaScript
import React from 'react';
import {render} from 'react-dom';
export default class ListActions extends React.Component {
constructor(props, context) {
super(props, context);
this.edit = this.edit.bind(this);
this.del = this.del.bind(this);
}
edit(_id) {
if (this.props.onEdit) {
this.props.onEdit(_id);
}
}
del(_id) {
if (!confirm("是否确认删除?")) {
return;
}
if (this.props.onDel) {
this.props.onDel(_id);
}
}
render() {
return (
<div className="btn-group">
<button className="btn btn-sm btn-info btn-flat" onClick={this.edit.bind(null, this.props._id)}>
<i className="fa fa-pencil-square-o"/>
</button>
<button className="btn btn-sm btn-info btn-flat" onClick={this.del.bind(null, this.props._id)}>
<i className="fa fa-trash-o"/>
</button>
{this.props.children}
</div>
)
}
}