4
4
v-for =" tab in tabs"
5
5
:key =" tab"
6
6
class =" left-pane-tab"
7
- :class =" { active: currentTab === tab }"
8
- @click =" currentTab = tab"
7
+ :class =" { active: currentTab === tab, disable: !hasTemplate }"
8
+ @click =" switchTab( tab) "
9
9
>
10
10
{{ tab }}
11
11
</div >
@@ -25,20 +25,36 @@ import TabHandlers from './TabHandlers.vue'
25
25
import TabLoggers from ' ./TabLoggers.vue'
26
26
import Message from ' ./Message.vue'
27
27
import { computed , ref } from ' vue'
28
- import { msg } from ' ../store.js'
28
+ import { msg , store } from ' ../store.js'
29
29
30
30
export default {
31
31
components: { TabTemplates, TabTraining, TabLoggers, TabHandlers, Message },
32
32
setup () {
33
33
const currentTab = ref (' Templates' )
34
- const tabs = ref ( [' Templates' , ' Training' , ' Handlers' , ' Loggers' ])
34
+ const tabs = [' Templates' , ' Training' , ' Handlers' , ' Loggers' ]
35
35
36
36
// computed properties
37
37
const currentTabComponent = computed (() => {
38
38
return ' tab-' + currentTab .value .toLowerCase ()
39
39
})
40
40
41
- return { currentTab, tabs, currentTabComponent, msg }
41
+ const switchTab = (tab ) => {
42
+ if (store .config .template ) {
43
+ currentTab .value = tab
44
+ }
45
+ }
46
+ const hasTemplate = computed (() => {
47
+ return store .config .template
48
+ })
49
+
50
+ return {
51
+ currentTab,
52
+ tabs,
53
+ currentTabComponent,
54
+ msg,
55
+ switchTab,
56
+ hasTemplate
57
+ }
42
58
}
43
59
}
44
60
</script >
@@ -69,6 +85,12 @@ export default {
69
85
padding : 0.4rem 0.8rem ;
70
86
border-bottom : 3px solid transparent ;
71
87
}
88
+ .disable {
89
+ cursor : not-allowed ;
90
+ }
91
+ .active {
92
+ cursor : pointer ;
93
+ }
72
94
.left-pane-tab :hover ,
73
95
.active {
74
96
color : var (--c-brand-red );
0 commit comments