|
@@ -6,7 +6,7 @@ import {
|
|
|
onBeforeRouteUpdate,
|
|
|
onBeforeRouteLeave
|
|
|
} from 'vue-router'
|
|
|
-import { defineComponent, onMounted, ref, watch } from 'vue'
|
|
|
+import { defineComponent, onMounted, reactive, ref, watch } from 'vue'
|
|
|
import mitt from 'mitt'
|
|
|
import Search from '@/components/col-search'
|
|
|
import { useLocalStorage } from '@vueuse/core'
|
|
@@ -14,6 +14,7 @@ import styles from './index.module.less'
|
|
|
import classNames from 'classnames'
|
|
|
import SelectTag from './select-tag'
|
|
|
import { getRandomKey, musicBuy } from '../music'
|
|
|
+import SelectSubject from './select-subject'
|
|
|
|
|
|
export const mitter = mitt()
|
|
|
|
|
@@ -26,22 +27,17 @@ export default defineComponent({
|
|
|
localStorage.setItem('behaviorId', getRandomKey())
|
|
|
const router = useRouter()
|
|
|
const route = useRoute()
|
|
|
- const loading = ref(false)
|
|
|
const keyword = ref('')
|
|
|
const tagids = ref('')
|
|
|
- const albumRows = ref([])
|
|
|
- const sheetRows = ref([])
|
|
|
const tagVisibility = ref(false)
|
|
|
const words = useLocalStorage<string[]>('music-search', [])
|
|
|
const activeTab = ref('songe')
|
|
|
|
|
|
onBeforeRouteUpdate(() => {
|
|
|
- // console.log('onBeforeRouteUpdate', route.fullPath)
|
|
|
if (route.path === '/music-songbook/search') {
|
|
|
keyword.value = ''
|
|
|
tagids.value = ''
|
|
|
activeTab.value = 'songe'
|
|
|
- // console.log('onBeforeRouteUpdate')
|
|
|
try {
|
|
|
selectTagRef.value?.resetTags?.()
|
|
|
} catch (error) {
|
|
@@ -66,18 +62,12 @@ export default defineComponent({
|
|
|
words.value.length = Math.min(words.value.length, 5)
|
|
|
}
|
|
|
mitter.emit('search', val)
|
|
|
- // const activeRef = activeTab.value === 'album' ? albumList : musicList
|
|
|
- // ;(activeRef.value as any).onSearch?.(val)
|
|
|
- // FetchList()
|
|
|
}
|
|
|
|
|
|
const onComfirm = (tags, name = '') => {
|
|
|
const data = Object.values(tags).flat().filter(Boolean).join(',')
|
|
|
tagids.value = data
|
|
|
mitter.emit('confirm', tags)
|
|
|
- // FetchList()
|
|
|
- // const activeRef = activeTab.value === 'album' ? albumList : musicList
|
|
|
- // ;(activeRef.value as any).onComfirm?.(tags)
|
|
|
tagVisibility.value = false
|
|
|
}
|
|
|
|
|
@@ -89,10 +79,12 @@ export default defineComponent({
|
|
|
subject.show = false
|
|
|
}
|
|
|
|
|
|
- onMounted(() => {
|
|
|
- // const activeRef = activeTab.value === 'album' ? albumList : musicList
|
|
|
- // ;(activeRef.value as any).onSearch?.('')
|
|
|
- // console.log(searchInputRef.value)
|
|
|
+ onMounted(() => {})
|
|
|
+
|
|
|
+ const subject = reactive({
|
|
|
+ show: false,
|
|
|
+ name: '全部',
|
|
|
+ id: ''
|
|
|
})
|
|
|
return () => {
|
|
|
return (
|