skyblued 2 vuotta sitten
vanhempi
commit
0e3c6954ce

+ 1 - 1
src/views/accompany/category.tsx

@@ -25,7 +25,7 @@ export default defineComponent({
               class={styles.container}
               style={{ backgroundImage: `url(${item.icon})` }}
               onClick={() => {
-                router.push({
+                router.replace({
                   path: '/accompany/musicList',
                   query: {
                     categorieid: item.id

+ 16 - 3
src/views/accompany/index.tsx

@@ -1,9 +1,11 @@
 import request from '@/helpers/request'
 import { state } from '@/state'
-import { defineComponent, reactive, onMounted } from 'vue'
-import { RouterView } from 'vue-router'
+import { defineComponent, reactive, onMounted,watch } from 'vue'
+import { RouterView, useRoute } from 'vue-router'
+import Category from './category'
 import { getImage } from './images'
 import styles from './index.module.less'
+import MusicList from './music-list'
 
 export default defineComponent({
   name: 'accompany',
@@ -34,7 +36,9 @@ export default defineComponent({
         btnText: 'GO >'
       }
     ]
+    const route = useRoute()
     const data = reactive({
+      childPath: '',
       svgs: [] as any,
       musicTreeActive: ''
     })
@@ -60,13 +64,22 @@ export default defineComponent({
           //   console.log('🚀 ~ data.svgs', data.svgs)
         }
       } catch (error) {}
+      handleOpen()
     }
+    const handleOpen = () => {
+      data.childPath = route.path.replaceAll('/', '')
+    }
+    watch(() => route.path, () => {
+        data.childPath = route.path.replaceAll('/', '')
+    })
     onMounted(() => {
       getTree()
     })
     return () => (
       <div class={styles.accompany}>
-        <RouterView musicTree={data.svgs} />
+        {/* <RouterView musicTree={data.svgs} /> */}
+        {data.childPath === 'accompany' && <Category musicTree={data.svgs} />}
+        {data.childPath === 'accompanymusicList' && <MusicList musicTree={data.svgs} />}
       </div>
     )
   }

+ 1 - 1
src/views/accompany/music-list.tsx

@@ -88,7 +88,7 @@ export default defineComponent({
           data: {
             ...data.pagenation,
             keyword: data.keyword,
-            musicTag: data.value2 || data.value1
+            // musicTag: data.value2 || data.value1
           }
         })
         if (Array.isArray(res?.data?.rows)) {