1
1
<script setup lang="ts">
2
2
import { computed , ref } from ' vue'
3
3
import { NModal , NSelect , NSpace } from ' naive-ui'
4
- import { GearButton , InputMethodConfig } from ' fcitx5-config-vue'
4
+ import { GearButton , GlobalConfig , InputMethodConfig , ThemeConfig } from ' fcitx5-config-vue'
5
5
import { inputMethod , inputMethods , loading } from ' ../fcitx'
6
6
import MenuButton from ' ./MenuButton.vue'
7
7
import GlobalButton from ' ./GlobalButton.vue'
@@ -16,6 +16,13 @@ const options = computed(() => {
16
16
})
17
17
18
18
const showModal = ref (false )
19
+ const modalType = ref <' im' | ' global' | ' theme' >(' im' )
20
+
21
+ const titleMap = {
22
+ im: ' Input Method Config' ,
23
+ global: ' Global Config' ,
24
+ theme: ' Theme Config' ,
25
+ }
19
26
</script >
20
27
21
28
<template >
@@ -26,21 +33,30 @@ const showModal = ref(false)
26
33
:loading =" loading"
27
34
:options =" options"
28
35
/>
29
- <GearButton @click =" showModal = true" />
36
+ <GearButton @click =" modalType = 'im'; showModal = true" />
30
37
<MenuButton />
31
- <GlobalButton />
32
- <ThemeButton />
38
+ <GlobalButton @click = " modalType = 'global'; showModal = true " />
39
+ <ThemeButton @click = " modalType = 'theme'; showModal = true " />
33
40
<AdvancedButton />
34
41
<NModal
35
42
v-model:show =" showModal"
36
43
preset =" card"
37
- title =" Input Method Config "
44
+ : title =" titleMap[modalType] "
38
45
>
39
46
<InputMethodConfig
47
+ v-if =" modalType === 'im'"
40
48
:input-method =" inputMethod"
41
49
:input-methods =" inputMethods"
42
50
@close =" showModal = false"
43
51
/>
52
+ <GlobalConfig
53
+ v-else-if =" modalType === 'global'"
54
+ @close =" showModal = false"
55
+ />
56
+ <ThemeConfig
57
+ v-else-if =" modalType === 'theme'"
58
+ @close =" showModal = false"
59
+ />
44
60
</NModal >
45
61
</NSpace >
46
62
</template >
0 commit comments