File tree 4 files changed +64
-3
lines changed
4 files changed +64
-3
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,14 @@ export const Component = {
8
8
setup ( ) {
9
9
return { args } ;
10
10
} ,
11
- template : '<ui-nav v-bind="args" @click-tab="setTab"><div slot="actions"><button>Action Button (slot example)</button></div></ui-nav>' ,
11
+ template : '<ui-nav v-bind="args" @click-tab="setTab" @go-back="goBack" ><div slot="actions"><button>Action Button (slot example)</button></div></ui-nav>' ,
12
12
methods : {
13
13
setTab ( { detail } ) {
14
14
this . args . currentTab = detail ;
15
15
} ,
16
+ goBack ( ) {
17
+ alert ( 'The back button was clicked!' ) ;
18
+ } ,
16
19
} ,
17
20
} ) ,
18
21
@@ -24,6 +27,7 @@ export const Component = {
24
27
{ value : 'first' , label : 'First tab' } ,
25
28
{ value : 'second' , label : 'Second tab' } ,
26
29
] ,
30
+ showBackButton : false ,
27
31
} ,
28
32
} ;
29
33
@@ -43,5 +47,6 @@ export default {
43
47
control : 'select' ,
44
48
options : Component . args . tabs . map ( v => v . value ) ,
45
49
} ,
50
+ showBackButton : 'boolean' ,
46
51
} ,
47
52
} ;
Original file line number Diff line number Diff line change @@ -9,12 +9,18 @@ export const Component = {
9
9
return { args } ;
10
10
} ,
11
11
template : `
12
- <ui-view v-bind="args">
12
+ <ui-view v-bind="args" @go-back="goBack" >
13
13
<div slot="loader">Loader slot: Loading...</div>
14
14
<div slot="actions"><button>Action Button (slot example)</button></div>
15
15
<div slot="first"><p>First tab content</p></div>
16
16
<div slot="second"><p>Second tab content</p></div>
17
- </ui-view>` ,
17
+ </ui-view>
18
+ ` ,
19
+ methods : {
20
+ goBack ( ) {
21
+ alert ( 'The back button was clicked!' ) ;
22
+ } ,
23
+ } ,
18
24
} ) ,
19
25
20
26
args : {
@@ -27,6 +33,7 @@ export const Component = {
27
33
{ value : 'first' , label : 'First tab' } ,
28
34
{ value : 'second' , label : 'Second tab' } ,
29
35
] ,
36
+ showBackButton : false ,
30
37
} ,
31
38
} ;
32
39
@@ -45,5 +52,6 @@ export default {
45
52
control : 'object' ,
46
53
} ,
47
54
currentTab : 'text' ,
55
+ showBackButton : 'boolean' ,
48
56
} ,
49
57
} ;
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" navigation-bar" >
3
+ <button
4
+ v-if =" showBackButton"
5
+ class =" navigation-bar__back-button"
6
+ @click =" $emit('go-back')"
7
+ >
8
+ <ui-icon
9
+ color =" #666666"
10
+ icon-name =" googleArrowBackBaseline"
11
+ size =" 24"
12
+ />
13
+ </button >
3
14
<div
4
15
v-if =" assistiveTitle"
5
16
class =" navigation-bar__page-title-holder"
42
53
43
54
<script >
44
55
import tabs from ' ~widgets/tabs/widget.vue' ;
56
+ import icon from ' ~widgets/icon/widget.vue' ;
45
57
import registerWidget from ' ~core/registerWidget' ;
46
58
47
59
registerWidget (' ui-tabs' , tabs);
60
+ registerWidget (' ui-icon' , icon);
48
61
49
62
export default {
50
63
props: {
@@ -67,7 +80,14 @@ export default {
67
80
type: String ,
68
81
default: ' ' ,
69
82
},
83
+
84
+ showBackButton: {
85
+ type: Boolean ,
86
+ default: false ,
87
+ },
70
88
},
89
+
90
+ emits: [' go-back' ],
71
91
};
72
92
</script >
73
93
@@ -129,6 +149,25 @@ export default {
129
149
align-items : center ;
130
150
flex : 0 0 auto ;
131
151
}
152
+
153
+ & __back-button {
154
+ height : 36px ;
155
+ width : 36px ;
156
+ margin : 0 24px 0 - 8px ;
157
+ padding : 0 ;
158
+ display : flex ;
159
+ justify-content : center ;
160
+ align-items : center ;
161
+ border : 0 ;
162
+ outline : none ;
163
+ border-radius : 2px ;
164
+ background-color : transparent ;
165
+ cursor : pointer ;
166
+
167
+ & :hover {
168
+ background-color : #e0 e0 e0 ;
169
+ }
170
+ }
132
171
}
133
172
134
173
.page-title {
Original file line number Diff line number Diff line change 12
12
class =" c-view__navigation"
13
13
:assistive-title =" assistiveTitle"
14
14
:current-tab =" activeTab"
15
+ :show-back-button =" showBackButton ? '' : null"
15
16
:title =" title"
16
17
.tabs =" tabs"
17
18
@click-tab =" setCurrentTab"
19
+ @go-back =" $emit('go-back')"
18
20
>
19
21
<slot name =" tabs" />
20
22
<!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
@@ -80,8 +82,15 @@ export default {
80
82
type: Array ,
81
83
default : () => [],
82
84
},
85
+
86
+ showBackButton: {
87
+ type: Boolean ,
88
+ default: false ,
89
+ },
83
90
},
84
91
92
+ emits: [' go-back' ],
93
+
85
94
data : () => ({
86
95
activeTab: ' ' ,
87
96
}),
You can’t perform that action at this time.
0 commit comments