|
@@ -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>
|
|
|
)
|
|
|
}
|