Skip to content

Commit

Permalink
tree select 4.x version
Browse files Browse the repository at this point in the history
  • Loading branch information
askuy committed May 3, 2022
1 parent c14f68d commit 7c07249
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@
GO结构体转换为Ant Design Pro设计规范

* Select
* TreeSelect
* TreeSelect
* ant 3.x 使用key作为值,使用eant v0.1.0版本
* ant 4.x 使用value作为值,使用eant v0.2.0版本


## Ant Design文档
* TreeSelect ant design树形结构 https://ant.design/components/tree-select-cn/#TreeNode-props
* Tree https://ant.design/components/tree-cn/#TreeNode-props
* Select https://ant.design/components/select-cn/#Option-props
6 changes: 3 additions & 3 deletions tree_select.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func (a *AntTreeSelect) GetOptions() AntTreeSelectOptions {

type AntTreeSelectOption struct {
Title string `json:"title"`
Pid interface{} `json:"pid"` // 父级id
Key interface{} `json:"key"` // 自己的id
Pid interface{} `json:"pid"` // 父级id
Value interface{} `json:"value"` // 自己的id
Disabled bool `json:"disabled"`
IsLeaf bool `json:"isLeaf"`
Children *AntTreeSelectOptions `json:"children,omitempty"`
Expand All @@ -51,7 +51,7 @@ type AntTreeSelectOptions []*AntTreeSelectOption
func (m AntTreeSelectOptions) toTree() AntTreeSelectOptions {
mTreeMap := make(map[interface{}]*AntTreeSelectOption)
for _, item := range m {
mTreeMap[item.Key] = item
mTreeMap[item.Value] = item
}

list := make(AntTreeSelectOptions, 0)
Expand Down

0 comments on commit 7c07249

Please sign in to comment.