We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
正常情况下:editable=true,contextmenu 正常显示隐藏 异常情况: 当editable为一个受控值时,将editable由true置为false再成为true,此时contextmenu无法显示; 以下为代码:
`import React from 'react' import Tree from '@hi-ui/hiui/es/tree'
class Demo extends React.Component { constructor(props) { super(props) this.state = { a: true, treeData: [ { id: 1, title: '小米快递', children: [ { id: 3, title: '后端', onClick: data => {console.log('后端:', data)} }, { id: 4, title: '运维' , disabled: true}, { id: 5, title: '前端' }, { id: 6, title: '点击右键', customData: 'Y' } ] } ] } } render() { return ( <div style={{width:500}}> <button onClick={() => this.setState({a: !this.state.a})}>click</button> <Tree searchable defaultExpandAll editable={this.state.a} data={this.state.treeData} onSave={(saveNode, data, level) => { if (level === 0) { Notification.open({ title:'保存失败', type:'error' }) return false } else { return true } console.log(saveNode, data,level) }} onDelete={(deleteNode, data) => { console.log(deleteNode, data) }} contextMenu={(currentItemData, level) => { if (currentItemData.customData === 'Y') { return [{ type: 'addChildNode' }] } return [{ type: 'editNode' }, { title: '自定义 Title-1', onClick: (item) => { alert(JSON.stringify(item)) } }, { type: 'editNode', title: '自定义 Title-2' }, { title: '自定义 Title-3', type: 'editNode', onClick: (item, node) => { console.log('执行内置事件') node.editNode(item) } }, { title: '自定义 Title-4', onClick: (item, node) => { console.log('自定义编辑节点事件') } }] }} onChange={data => {console.log('Tree data:', data)}} /> </div> ) }
}`
The text was updated successfully, but these errors were encountered:
fix: #1761
92a6088
Merge pull request #1765 from XiaoMi/feature/#1761
2097130
02aa211
Successfully merging a pull request may close this issue.
正常情况下:editable=true,contextmenu 正常显示隐藏
异常情况: 当editable为一个受控值时,将editable由true置为false再成为true,此时contextmenu无法显示;
以下为代码:
`import React from 'react'
import Tree from '@hi-ui/hiui/es/tree'
}`
The text was updated successfully, but these errors were encountered: