# BsTabPanel 状态按钮
状态按钮面板,显示状态按钮 / 右侧按钮组
# 只有状态按钮
只显示状态按钮,没有右侧按钮组
只有状态按钮
<template>
<BsTabPanel
is-hide-query
:tab-status-btn-config="tabStatusBtnConfig"
/>
</template>
<script>
export default {
data() {
return {
tabStatusBtnConfig: {
changeBtns: false,
buttons: [
{
type: 'button',
label: '全部',
code: 'whole'
},
{
type: 'button',
label: '未审核',
code: 'notreviewed'
},
{
type: 'button',
label: '已审核',
code: 'reviewed'
}
],
curButton: {
type: 'button',
label: '未审核',
code: 'notreviewed'
},
buttonsInfo: {}
},
}
}
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Expand Copy Copy
# 既显示状态按钮又显示右侧按钮组,且有联动
显示状态按钮和右侧按钮组,当切换状态按钮时,右侧按钮组跟着切换
状态按钮或右侧按钮点击事件通过事件回调
<template>
<BsTabPanel
is-hide-query
:tab-status-btn-config="tabStatusBtnConfig"
@tabClick="onTabPaneltabClick"
@btnClick="onTabPanelBtnClick"
/>
</template>
<script>
export default {
data() {
return {
tabStatusBtnConfig: {
changeBtns: true,
buttons: [
{
type: 'button',
label: '全部',
code: 'whole'
},
{
type: 'button',
label: '未审核',
code: 'notreviewed'
},
{
type: 'button',
label: '已审核',
code: 'reviewed'
}
],
curButton: {
type: 'button',
label: '未审核',
code: 'notreviewed'
},
buttonsInfo: {
'notreviewed': [
{
label: '提取',
code: 'extract',
status: 'primary'
},
{
label: '保存',
code: 'save'
},
{
label: '提交',
code: 'submit'
}
],
'whole': [
{
label: '操作日志',
code: 'operationLog'
}
],
'reviewed': [
{
label: '撤销提交',
code: 'cxtj'
}
]
}
}
}
},
methods: {
/**
* @description: 状态按钮组,左侧状态按钮切换
* @param {*} obj
* @return {*}
* @eg:
*/
onTabPaneltabClick(obj) {
this.$message({
showClose: true,
message: obj.label,
type: 'success'
});
},
/**
* @description: 状态按钮组,右侧按钮触发
* @param {*} obj
* @return {*}
* @eg:
*/
onTabPanelBtnClick(obj) {
this.$message({
showClose: true,
message: obj.label,
type: 'success'
});
},
}
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
Expand Copy Copy
# 既显示状态按钮又显示右侧按钮组,但没有联动
显示状态按钮和右侧按钮组,当切换状态按钮时,右侧按钮显示不变
状态按钮或右侧按钮点击事件通过配置的方法回调
<template>
<BsTabPanel
is-hide-query
:tab-status-btn-config="tabStatusBtnConfig"
:rightButtons="rightButtons"
/>
</template>
<script>
export default {
data() {
return {
init: true,
tabStatusBtnConfig: {
changeBtns: false,
buttons: [
{
type: 'button',
label: '全部',
code: 'whole'
},
{
type: 'button',
label: '未审核',
code: 'notreviewed'
},
{
type: 'button',
label: '已审核',
code: 'reviewed'
}
],
curButton: {
type: 'button',
label: '未审核',
code: 'notreviewed'
},
methods: {
bsToolbarClickEvent: this.bsToolbarClickEvent
}
},
rightButtons: [
{
label: '提取',
code: 'extract',
status: 'primary'
},
{
label: '保存',
code: 'save'
},
{
label: '提交',
code: 'submit'
}
]
}
},
methods: {
/**
* @description: 状态按钮切换 / 右侧按钮触发
* @param {*} obj
* @return {*}
* @eg:
*/
bsToolbarClickEvent(obj) {
if (this.init) {
this.init = false
return
}
this.$message({
showClose: true,
message: obj.label,
type: 'success'
});
}
}
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Expand Copy Copy