File tree 3 files changed +23
-14
lines changed
3 files changed +23
-14
lines changed Original file line number Diff line number Diff line change 6
6
</template >
7
7
</component >
8
8
<slot ></slot >
9
- <span v-if =" isHideMulti() " >{{ state.content }}</span >
9
+ <span v-if =" isShowContent " >{{ state.content }}</span >
10
10
</span >
11
11
</template >
12
12
@@ -50,13 +50,9 @@ export default {
50
50
emit (' click-api' )
51
51
}
52
52
53
- const isShowMulti = () => (state .options ? .collapsed || props .position === ' collapse' ) && state .options ? .multiType
54
- const isHideMulti = () => (state .options ? .collapsed || props .position === ' collapse' ) && ! state .options ? .multiType
53
+ const isShowContent = computed (() => (state .options ? .collapsed || props .position === ' collapse' ) && props .content )
55
54
56
55
const getRender = () => {
57
- if (isShowMulti ()) {
58
- return false
59
- }
60
56
if (props .options .renderType === ' button' ) {
61
57
return ToolbarBaseButton
62
58
}
@@ -70,8 +66,7 @@ export default {
70
66
state,
71
67
click,
72
68
getRender,
73
- isShowMulti,
74
- isHideMulti
69
+ isShowContent
75
70
}
76
71
}
77
72
}
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ export default {
6
6
icon : {
7
7
default : 'light'
8
8
} ,
9
- renderType : 'icon' ,
10
- multiType : true
9
+ renderType : 'icon'
11
10
}
12
11
}
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" toolbar-theme-switch" >
3
3
<toolbar-base
4
- :content =" state.themeLabel "
5
- :icon =" state.theme "
6
- :options =" options "
4
+ :content =" baseContent "
5
+ :icon =" baseIcon "
6
+ :options =" optionsData "
7
7
:position =" position"
8
8
@click-api =" themeChange"
9
9
>
19
19
</template >
20
20
21
21
<script >
22
+ import { computed } from ' vue'
22
23
import { ToolbarBase } from ' @opentiny/tiny-engine-common'
23
24
import { RadioGroup } from ' @opentiny/vue'
24
25
import useThemeSwitch from ' ./composable/useThemeSwitch.js'
@@ -40,10 +41,21 @@ export default {
40
41
},
41
42
setup (props ) {
42
43
const THEME_DATA = useThemeSwitch ().THEME_DATA
44
+ const COLLAPSE = ' collapse'
43
45
const state = useThemeSwitch ().initThemeState ()
46
+ const optionsData = computed (() => {
47
+ const options = { ... props .options }
48
+ if (props .position === COLLAPSE ) {
49
+ options .renderType = ' '
50
+ }
51
+
52
+ return options
53
+ })
54
+ const baseContent = computed (() => (props .position === COLLAPSE ? ' ' : state .themeLabel ))
55
+ const baseIcon = computed (() => (props .position === COLLAPSE ? ' ' : state .theme ))
44
56
45
57
const themeChange = () => {
46
- if (props .position === ' collapse ' ) {
58
+ if (props .position === COLLAPSE ) {
47
59
return
48
60
}
49
61
@@ -55,6 +67,9 @@ export default {
55
67
return {
56
68
THEME_DATA ,
57
69
state,
70
+ optionsData,
71
+ baseContent,
72
+ baseIcon,
58
73
themeChange,
59
74
radioChange
60
75
}
You can’t perform that action at this time.
0 commit comments