Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
fb43e548
提交
fb43e548
authored
4月 08, 2022
作者:
zuihou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(BasicTree): 支持设置加载中
上级
1e0ede09
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
36 行增加
和
6 行删除
+36
-6
Tree.vue
src/components/Tree/src/Tree.vue
+11
-5
tree.ts
src/components/Tree/src/tree.ts
+4
-0
index.vue
src/views/demo/tree/index.vue
+21
-1
没有找到文件。
src/components/Tree/src/Tree.vue
浏览文件 @
fb43e548
...
...
@@ -14,7 +14,7 @@
onMounted
,
}
from
'vue'
;
import
TreeHeader
from
'./TreeHeader.vue'
;
import
{
Tree
,
Empty
}
from
'ant-design-vue'
;
import
{
Tree
,
Spin
,
Empty
}
from
'ant-design-vue'
;
import
{
TreeIcon
}
from
'./TreeIcon'
;
import
{
ScrollContainer
}
from
'/@/components/Container'
;
import
{
omit
,
get
,
difference
,
cloneDeep
}
from
'lodash-es'
;
...
...
@@ -426,10 +426,16 @@
{
extendSlots
(
slots
)}
<
/TreeHeader
>
)}
<
ScrollContainer
style
=
{
scrollStyle
}
v
-
show
=
{
!
unref
(
getNotFound
)}
>
<
Tree
{...
unref
(
getBindValues
)}
showIcon
=
{
false
}
treeData
=
{
treeData
.
value
}
/
>
<
/ScrollContainer
>
<
Empty
v
-
show
=
{
unref
(
getNotFound
)}
image
=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
class
=
"!mt-4"
/>
<
Spin
spinning
=
{
unref
(
props
.
loading
)}
tip
=
"加载中..."
>
<
ScrollContainer
style
=
{
scrollStyle
}
v
-
show
=
{
!
unref
(
getNotFound
)}
>
<
Tree
{...
unref
(
getBindValues
)}
showIcon
=
{
false
}
treeData
=
{
treeData
.
value
}
/
>
<
/ScrollContainer
>
<
Empty
v
-
show
=
{
unref
(
getNotFound
)}
image
=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
class
=
"!mt-4"
/>
<
/Spin
>
<
/div
>
);
};
...
...
src/components/Tree/src/tree.ts
浏览文件 @
fb43e548
...
...
@@ -130,6 +130,10 @@ export const treeProps = buildProps({
checkOnSearch
:
Boolean
,
// 搜索完成自动select所有结果
selectedOnSearch
:
Boolean
,
loading
:
{
type
:
Boolean
,
default
:
false
,
},
});
export
type
TreeProps
=
ExtractPropTypes
<
typeof
treeProps
>
;
...
...
src/views/demo/tree/index.vue
浏览文件 @
fb43e548
...
...
@@ -32,7 +32,7 @@
:load-data=
"onLoadData"
/>
</Col>
<Col
:span=
"
16
"
>
<Col
:span=
"
8
"
>
<Card
title=
"异步数据,默认展开"
>
<
template
#
extra
>
<a-button
@
click=
"loadTreeData"
:loading=
"treeLoading"
>
加载数据
</a-button>
...
...
@@ -42,6 +42,14 @@
</Spin>
</Card>
</Col>
<Col
:span=
"8"
>
<Card
title=
"BasicTree内置加载"
>
<
template
#
extra
>
<a-button
@
click=
"loadTreeData2"
:loading=
"treeLoading"
>
请求数据
</a-button>
</
template
>
<BasicTree
ref=
"loadTreeRef"
:treeData=
"tree2"
:loading=
"treeLoading"
/>
</Card>
</Col>
</Row>
</PageWrapper>
</template>
...
...
@@ -58,6 +66,7 @@
setup
()
{
const
asyncTreeRef
=
ref
<
Nullable
<
TreeActionType
>>
(
null
);
const
asyncExpandTreeRef
=
ref
<
Nullable
<
TreeActionType
>>
(
null
);
const
loadTreeRef
=
ref
<
Nullable
<
TreeActionType
>>
(
null
);
const
tree2
=
ref
<
TreeItem
[]
>
([]);
const
treeLoading
=
ref
(
false
);
...
...
@@ -79,6 +88,15 @@
});
},
2000
);
}
function
loadTreeData2
()
{
treeLoading
.
value
=
true
;
// 以下是模拟异步获取数据
setTimeout
(()
=>
{
// 设置数据源
tree2
.
value
=
cloneDeep
(
treeData
);
treeLoading
.
value
=
false
;
},
2000
);
}
const
tree
=
ref
([
{
...
...
@@ -119,9 +137,11 @@
onLoadData
,
asyncTreeRef
,
asyncExpandTreeRef
,
loadTreeRef
,
tree2
,
loadTreeData
,
treeLoading
,
loadTreeData2
,
};
},
});
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论