liushengqiang 1 year ago
parent
commit
3a2ae06fbd

+ 4 - 2
src/subpages/colexiu/plugins/toggleMusicSheet/choosePartName/index.tsx

@@ -17,7 +17,7 @@ export default defineComponent({
   emits: ['close'],
   setup(props, { emit }) {
     const { partListNames, partIndex } = toRefs(props)
-    const selectIndex = ref(0)
+    const selectIndex = ref((partListNames.value[partIndex.value] as any).value)
     const columns = computed(() => {
       return partListNames.value
     })
@@ -37,7 +37,9 @@ export default defineComponent({
             selectIndex.value = row.value
           }}
         />
-        <Button class={styles.button} type="primary" round block onClick={() => emit('close', selectIndex.value)}>
+        <Button class={styles.button} type="primary" round block onClick={() => {
+          emit('close', selectIndex.value)}
+        }>
           确定
         </Button>
       </div>

+ 7 - 1
src/subpages/colexiu/plugins/toggleMusicSheet/index.tsx

@@ -34,6 +34,11 @@ export default defineComponent({
       }).filter(Boolean)
     })
 
+    const partIndex = computed(() => {
+      const partIndex = partListNames.value.findIndex((item: any) => item.value === state.partIndex)
+      return partIndex > -1 ? partIndex : 0
+    })
+
     const switchMusic = (index: number) => {
       // 暂停播放
       RuntimeUtils.pause()
@@ -65,9 +70,10 @@ export default defineComponent({
     return () => (
       <Popup class={styles.popup} v-model:show={toggleMusicSheet.show}>
         <ChoosePartName
-          partIndex={state.partIndex || 0}
+          partIndex={partIndex.value}
           partListNames={partListNames.value}
           onClose={(value) => {
+            console.log("🚀 ~ value:", value)
             toggleMusicSheet.show = false
             if (value !== undefined) {
               switchMusic(value)