Procházet zdrojové kódy

修改部分问题

wolyshaw před 2 roky
rodič
revize
1ec661b307

+ 1 - 0
src/components/col-search/index.module.less

@@ -9,6 +9,7 @@
   }
 }
 .col-search {
+  --van-cell-background-color: transparent;
   // padding-left: 14px;
   // padding-right: 14px;
   :global {

+ 0 - 1
src/student/music/search/header.tsx

@@ -40,7 +40,6 @@ export default defineComponent({
       if (route.path === '/music-songbook/search') {
         keyword.value = ''
         tagids.value = ''
-
         // console.log('onBeforeRouteUpdate')
         selectTagRef.value.resetTags()
       }

+ 12 - 11
src/student/music/search/select-tag.tsx

@@ -1,6 +1,6 @@
 import request from '@/helpers/request'
 import { useAsyncState } from '@vueuse/core'
-import { defineComponent, reactive, ref, watch } from 'vue'
+import { defineComponent, reactive, Ref, ref, watch } from 'vue'
 import { state as appState } from '@/state'
 import { Button } from 'vant'
 import SelectTagsChild from './select-tags-child'
@@ -31,16 +31,17 @@ export default defineComponent({
       null
     )
     const resetTags = () => {
-      for (const key in tags) {
-        if (Object.prototype.hasOwnProperty.call(tags, key)) {
-          delete tags[key]
-        }
-      }
+      tags.value = {}
+      // for (const key in tags) {
+      //   if (Object.prototype.hasOwnProperty.call(tags, key)) {
+      //     // delete tags[key]
+      //   }
+      // }
       emit('cancel')
     }
 
     const defaultTags = (defaultValue || '').split(',').map(id => Number(id))
-    const tags: { [key in string]: number[] } = reactive({})
+    const tags: Ref<{ [key in string]: number[] }> = ref({})
     const names = {}
     watch(state, () => {
       if (state.value) {
@@ -50,7 +51,7 @@ export default defineComponent({
             names[c.id] = c.name
             return c.id
           })
-          tags[item.id] = defaultTags.filter(id => {
+          tags.value[item.id] = defaultTags.filter(id => {
             return allids.includes(Number(id))
           })
         }
@@ -77,10 +78,10 @@ export default defineComponent({
                   <SelectTagsChild
                     key={item.id}
                     // @ts-ignore
-                    selected={tags[item.id] || []}
+                    selected={tags.value[item.id] || []}
                     child={item.children || []}
                     onSelect={val => {
-                      tags[item.id] = val
+                      tags.value[item.id] = val
                     }}
                     {...restProps}
                   />
@@ -96,7 +97,7 @@ export default defineComponent({
               class={styles.btn}
               type="primary"
               round
-              onClick={() => emit('confirm', tags, names)}
+              onClick={() => emit('confirm', tags.value, names)}
             >
               确认
             </Button>