@@ -10,6 +10,18 @@ import { useI18n } from 'vue-i18n';
1010import { locale } from "@/locales" ;
1111import { ENTRY_LABEL_CLASS } from "./constants" ;
1212
13+ /* t需要传入是Vue的i18n翻译函数 */
14+ export function optionsIoKeyMap ( t : ( key : string ) => string ) : { label : string , value : string } [ ] {
15+ return [
16+ { label : t ( 'mod.ioKeyMap.disabled' ) , value : 'None' } ,
17+ { label : t ( 'mod.ioKeyMap.select' ) , value : 'Select' } ,
18+ { label : t ( 'mod.ioKeyMap.select1P' ) , value : 'Select1P' } ,
19+ { label : t ( 'mod.ioKeyMap.select2P' ) , value : 'Select2P' } ,
20+ { label : t ( 'mod.ioKeyMap.service' ) , value : 'Service' } ,
21+ { label : t ( 'mod.ioKeyMap.test' ) , value : 'Test' } ,
22+ ] ;
23+ }
24+
1325export default defineComponent ( {
1426 props : {
1527 entry : { type : Object as PropType < Entry > , required : true } ,
@@ -18,15 +30,6 @@ export default defineComponent({
1830 setup ( props , { emit } ) {
1931 const { t, te } = useI18n ( ) ;
2032
21- const optionsIoKeyMap = [
22- { label : t ( 'mod.ioKeyMap.disabled' ) , value : 'None' } ,
23- { label : t ( 'mod.ioKeyMap.select' ) , value : 'Select' } ,
24- { label : t ( 'mod.ioKeyMap.select1P' ) , value : 'Select1P' } ,
25- { label : t ( 'mod.ioKeyMap.select2P' ) , value : 'Select2P' } ,
26- { label : t ( 'mod.ioKeyMap.service' ) , value : 'Service' } ,
27- { label : t ( 'mod.ioKeyMap.test' ) , value : 'Test' } ,
28- ] ;
29-
3033 const optionsSoundChannel = [ 'None' , 'P1SpeakerLeft' , 'P1SpeakerRight' , 'P1HeadphoneLeft' , 'P1HeadphoneRight' , 'P2SpeakerLeft' , 'P2SpeakerRight' , 'P2HeadphoneLeft' , 'P2HeadphoneRight' ]
3134 . map ( channel => ( { label : t ( 'mod.soundChannel.' + channel ) , value : channel } ) ) ;
3235
@@ -78,9 +81,9 @@ export default defineComponent({
7881 case 'AquaMai.Config.Types.KeyCodeID' :
7982 return < Select v-model :value = { props . entryState . value } options = { Object . entries ( KeyCodeID ) . map ( ( [ label , value ] ) => ( { label, value} ) ) } /> ;
8083 case 'AquaMai.Config.Types.IOKeyMap' :
81- return < Select v-model :value = { props . entryState . value } options = { optionsIoKeyMap } /> ;
84+ return < Select v-model :value = { props . entryState . value } options = { optionsIoKeyMap ( t ) } /> ;
8285 case 'AquaMai.Config.Types.AdxKeyMap' :
83- return < Select v-model :value = { props . entryState . value } options = { optionsIoKeyMap } /> ;
86+ return < Select v-model :value = { props . entryState . value } options = { optionsIoKeyMap ( t ) } /> ;
8487 case 'AquaMai.Config.Types.SoundChannel' :
8588 return < Select v-model :value = { props . entryState . value } options = { optionsSoundChannel } /> ;
8689 }
0 commit comments