Ver Fonte

修改显示

lex há 1 ano atrás
pai
commit
ccada615ee

+ 1 - 1
src/views/prepare-lessons/components/resource-main/index.tsx

@@ -151,7 +151,7 @@ export default defineComponent({
           class={['modalTitle', styles.selectMusicModal]}
           preset="card"
           title={'选择资源'}>
-          <SelectResources />
+          <SelectResources type={forms.tabType} />
         </NModal>
 
         <NModal

+ 15 - 4
src/views/prepare-lessons/model/select-resources/index.tsx

@@ -1,20 +1,31 @@
 import { NTabPane, NTabs } from 'naive-ui';
-import { defineComponent } from 'vue';
+import { defineComponent, ref, toRefs } from 'vue';
 import styles from './index.module.less';
 import SelectItem from './select-item';
 
 export default defineComponent({
   name: 'select-music',
+  props: {
+    type: {
+      type: String,
+      default: 'myResources'
+    }
+  },
   emits: ['select'],
-  setup(props, { emit }) {
+  setup(props) {
+    const { type } = toRefs(props);
+    const tabType = ref(type.value);
     return () => (
       <div class={styles.selectMusic}>
         <NTabs
           animated
-          defaultValue="myResources"
+          value={tabType.value}
           paneClass={styles.paneTitle}
           justifyContent="center"
-          paneWrapperClass={styles.paneWrapperContainer}>
+          paneWrapperClass={styles.paneWrapperContainer}
+          onUpdate:value={(val: string) => {
+            tabType.value = val;
+          }}>
           <NTabPane
             name="myResources"
             tab="我的资源"