update 细节处理
This commit is contained in:
@@ -5,24 +5,41 @@ function renderActions() {
|
||||
const { children } = this.props
|
||||
const actions = []
|
||||
|
||||
Array.isArray(children) ? children
|
||||
.filter(action => action)
|
||||
.forEach((action, i) => {
|
||||
actions.push(action)
|
||||
if (i < this.props.children.length - 1) {
|
||||
actions.push(<Divider type="vertical" key={i} />)
|
||||
}
|
||||
}) : (actions.push(children))
|
||||
Array.isArray(children)
|
||||
? children
|
||||
.filter(action => action)
|
||||
.forEach((action, i) => {
|
||||
actions.push(action, <Divider type="vertical" key={i} />)
|
||||
})
|
||||
: actions.push(children)
|
||||
|
||||
return actions
|
||||
}
|
||||
|
||||
export default class QueryTableActions extends Component {
|
||||
componentDidMount() {
|
||||
// 删除多余的间隔线
|
||||
const className = 'ant-divider ant-divider-vertical'
|
||||
let series = false
|
||||
for (const node of this.refs.inner.childNodes) {
|
||||
if (
|
||||
(series && node.className == className) ||
|
||||
(!node.nextElementSibling && node.className == className)
|
||||
) {
|
||||
node.remove()
|
||||
series = false
|
||||
} else if (node.className == className) {
|
||||
series = true
|
||||
} else {
|
||||
series = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="yo-table-actions">
|
||||
<div className="yo-table-actions--inner">
|
||||
<div className="yo-table-actions--inner" ref="inner">
|
||||
{renderActions.call(this)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user