File tree Expand file tree Collapse file tree 2 files changed +68
-0
lines changed
packages/pro-layout/examples Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,12 @@ const routes: RouteRecordRaw[] = [
104
104
} ,
105
105
] ,
106
106
} ,
107
+ {
108
+ path : '/test-tab' ,
109
+ name : 'TestTab' ,
110
+ meta : { title : '测试Tab标签' , hideInMenu : false } ,
111
+ component : ( ) => import ( '../views/TestTab.vue' ) ,
112
+ } ,
107
113
{
108
114
path : 'https://next.antdv.com/' ,
109
115
name : 'baidu_target' ,
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <PageContainer
3
+ :loading =" loading"
4
+ fixed-header
5
+ :title =" (route.meta.title as string)"
6
+ :tab-list =" tabList"
7
+ :tab-active-key =" tabActiveKey"
8
+ @tab-change =" tabChange"
9
+ :tabProps =" {
10
+ hideAdd: true,
11
+ tabPosition: 'top',
12
+ type: 'editable-card',
13
+ tabBarGutter: 8,
14
+ tabBarStyle: { margin: '0', height: '32px', lineHeight: '32px' },
15
+ onEdit: tabEdit,
16
+ }"
17
+ >
18
+ <template #tags >
19
+ <Tag >tag1</Tag >
20
+ <Tag color =" pink" >tag2</Tag >
21
+ </template >
22
+ <Result
23
+ status =" info"
24
+ :style =" {
25
+ height: '100%',
26
+ }"
27
+ title =" show tabs"
28
+ sub-title =" pro-layout可使用 tabRender 插槽自定义标签页"
29
+ >
30
+ <template #extra >
31
+ <Button type =" primary" >ME {{ tabActiveKey }}</Button >
32
+ </template >
33
+ </Result >
34
+ </PageContainer >
35
+ </template >
36
+
37
+ <script setup lang="ts">
38
+ import { Button , Tag , Result } from " ant-design-vue" ;
39
+ import { PageContainer } from " @ant-design-vue/pro-layout" ;
40
+
41
+ import { useRoute } from " vue-router" ;
42
+ import { reactive , ref } from " vue" ;
43
+
44
+ const route = useRoute ();
45
+
46
+ let loading = ref <boolean >(false )
47
+ let tabList = reactive (
48
+ Array .from ({ length: 54 }, (_ , i ) => ({ key: " /tab" + i , tab: " tab" + i }))
49
+ );
50
+ let tabActiveKey = ref (" /tab1" );
51
+ function tabChange(key : string ) {
52
+ console .log (" tabChange" , key );
53
+ tabActiveKey .value = key ;
54
+ }
55
+ function tabEdit(key : string ) {
56
+ console .log (" tabEdit" , key );
57
+ loading .value = true
58
+ setTimeout (() => {
59
+ loading .value = false
60
+ }, 2000 );
61
+ }
62
+ </script >
You can’t perform that action at this time.
0 commit comments