Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
啊嘞嘞EC
vue-vben-admin
提交
e6960896
V
vue-vben-admin
项目概览
啊嘞嘞EC
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e6960896
编写于
3月 04, 2021
作者:
V
Vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(tree): add clickRowToExpand option close #318
上级
80b47c84
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
36 addition
and
13 deletion
+36
-13
CHANGELOG.zh_CN.md
CHANGELOG.zh_CN.md
+6
-0
src/components/Tree/src/index.vue
src/components/Tree/src/index.vue
+24
-8
src/components/Tree/src/props.ts
src/components/Tree/src/props.ts
+1
-0
src/components/Tree/src/types.ts
src/components/Tree/src/types.ts
+3
-4
src/views/demo/system/account/AccountModal.vue
src/views/demo/system/account/AccountModal.vue
+2
-1
未找到文件。
CHANGELOG.zh_CN.md
浏览文件 @
e6960896
## Wip
### ✨ Features
-
`BasicTree`
新增
`clickRowToExpand`
,用于单击树节点展开
### 🐛 Bug Fixes
-
修复
`Description`
已知问题
-
修复
`BasicForm`
已知问题
-
修复
`BasicTree`
下 ActionItem 的 show 属性逻辑问题
-
修复树组件 demo 示例样式错误
-
修复账号管理新增未清空旧数据
## 2.0.2 (2021-03-04)
...
...
src/components/Tree/src/index.vue
浏览文件 @
e6960896
...
...
@@ -121,7 +121,7 @@
return
icon
;
}
async
function
handleRightClick
({
event
,
node
}:
any
)
{
async
function
handleRightClick
({
event
,
node
}:
Recordable
)
{
const
{
rightMenuList
:
menuList
=
[],
beforeRightClick
}
=
props
;
let
rightMenuList
:
ContextMenuItem
[]
=
[];
...
...
@@ -137,14 +137,14 @@
});
}
function
setExpandedKeys
(
keys
:
string
[]
)
{
function
setExpandedKeys
(
keys
:
Keys
)
{
state
.
expandedKeys
=
keys
;
}
function
getExpandedKeys
()
{
return
state
.
expandedKeys
;
}
function
setSelectedKeys
(
keys
:
string
[]
)
{
function
setSelectedKeys
(
keys
:
Keys
)
{
state
.
selectedKeys
=
keys
;
}
...
...
@@ -182,10 +182,23 @@
searchState
.
searchData
=
filter
(
unref
(
treeDataRef
),
(
node
)
=>
{
const
{
title
}
=
node
;
return
title
?.
includes
(
searchValue
)
??
false
;
// || key?.includes(searchValue);
});
}
function
handleClickNode
(
key
:
string
,
children
:
TreeItem
[])
{
if
(
!
props
.
clickRowToExpand
||
!
children
||
children
.
length
===
0
)
return
;
if
(
!
state
.
expandedKeys
.
includes
(
key
))
{
setExpandedKeys
([...
state
.
expandedKeys
,
key
]);
}
else
{
const
keys
=
[...
state
.
expandedKeys
];
const
index
=
keys
.
findIndex
((
item
)
=>
item
===
key
);
if
(
index
!==
-
1
)
{
keys
.
splice
(
index
,
1
);
}
setExpandedKeys
(
keys
);
}
}
watchEffect
(()
=>
{
treeDataRef
.
value
=
props
.
treeData
as
TreeItem
[];
state
.
expandedKeys
=
props
.
expandedKeys
;
...
...
@@ -264,11 +277,15 @@
const
propsData
=
omit
(
item
,
'
title
'
);
const
icon
=
getIcon
({
...
item
,
level
},
item
.
icon
);
const
children
=
get
(
item
,
childrenField
)
||
[];
return
(
<
Tree
.
TreeNode
{...
propsData
}
node
=
{
toRaw
(
item
)}
key
=
{
get
(
item
,
keyField
)}
>
{{
title
:
()
=>
(
<
span
class
=
{
`
${
prefixCls
}
-title pl-2`
}
>
<
span
class
=
{
`
${
prefixCls
}
-title pl-2`
}
onClick
=
{
handleClickNode
.
bind
(
null
,
item
.
key
,
children
)}
>
{
icon
&&
<
TreeIcon
icon
=
{
icon
}
/>
}
<
span
class
=
{
`
${
prefixCls
}
__content`
}
...
...
@@ -279,8 +296,7 @@
<
span
class
=
{
`
${
prefixCls
}
__actions`
}
>
{
renderAction
({
...
item
,
level
})}
<
/span
>
<
/span
>
),
default
:
()
=>
renderTreeNode
({
data
:
get
(
item
,
childrenField
)
||
[],
level
:
level
+
1
}),
default
:
()
=>
renderTreeNode
({
data
:
children
,
level
:
level
+
1
}),
}}
<
/Tree.TreeNode
>
);
...
...
@@ -289,7 +305,7 @@
return
()
=>
{
const
{
title
,
helpMessage
,
toolbar
,
search
}
=
props
;
return
(
<
div
class
=
{[
prefixCls
,
'
h-full bg-white
'
]}
>
<
div
class
=
{[
prefixCls
,
'
h-full bg-white
'
,
attrs
.
class
]}
>
{(
title
||
toolbar
||
search
)
&&
(
<
TreeHeader
checkAll
=
{
checkAll
}
...
...
src/components/Tree/src/props.ts
浏览文件 @
e6960896
...
...
@@ -21,6 +21,7 @@ export const basicProps = {
toolbar
:
propTypes
.
bool
,
search
:
propTypes
.
bool
,
checkStrictly
:
propTypes
.
bool
,
clickRowToExpand
:
propTypes
.
bool
.
def
(
true
),
replaceFields
:
{
type
:
Object
as
PropType
<
ReplaceFields
>
,
...
...
src/components/Tree/src/types.ts
浏览文件 @
e6960896
...
...
@@ -14,11 +14,10 @@ export interface ReplaceFields {
key
?:
string
;
}
export
type
Keys
=
string
[]
|
number
[];
export
type
Keys
=
(
string
|
number
)
[];
export
type
CheckKeys
=
|
string
[]
|
number
[]
|
{
checked
:
string
[]
|
number
[];
halfChecked
:
string
[]
|
number
[]
};
|
(
string
|
number
)[]
|
{
checked
:
(
string
|
number
)[];
halfChecked
:
(
string
|
number
)[]
};
export
interface
TreeActionType
{
checkAll
:
(
checkAll
:
boolean
)
=>
void
;
...
...
src/views/demo/system/account/AccountModal.vue
浏览文件 @
e6960896
...
...
@@ -17,7 +17,7 @@
setup
(
_
,
{
emit
})
{
const
isUpdate
=
ref
(
true
);
const
[
registerForm
,
{
setFieldsValue
,
updateSchema
,
validate
}]
=
useForm
({
const
[
registerForm
,
{
setFieldsValue
,
updateSchema
,
resetFields
,
validate
}]
=
useForm
({
labelWidth
:
100
,
schemas
:
accountFormSchema
,
showActionButtonGroup
:
false
,
...
...
@@ -27,6 +27,7 @@
});
const
[
registerModal
,
{
setModalProps
}]
=
useModalInner
(
async
(
data
)
=>
{
resetFields
();
setModalProps
({
confirmLoading
:
false
});
isUpdate
.
value
=
!!
data
?.
isUpdate
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录