index.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { NTabPane, NTabs } from 'naive-ui';
  2. import { defineComponent, ref, toRefs } from 'vue';
  3. import styles from './index.module.less';
  4. import SelectItem from './select-item';
  5. export default defineComponent({
  6. name: 'select-music',
  7. props: {
  8. type: {
  9. type: String,
  10. default: 'myResources'
  11. }
  12. },
  13. emits: ['select'],
  14. setup(props) {
  15. const { type } = toRefs(props);
  16. const tabType = ref(type.value);
  17. return () => (
  18. <div class={styles.selectMusic}>
  19. <NTabs
  20. animated
  21. value={tabType.value}
  22. paneClass={styles.paneTitle}
  23. justifyContent="center"
  24. paneWrapperClass={styles.paneWrapperContainer}
  25. onUpdate:value={(val: string) => {
  26. tabType.value = val;
  27. }}>
  28. <NTabPane
  29. name="myResources"
  30. tab="我的资源"
  31. displayDirective="show:lazy">
  32. <SelectItem type="myResources" />
  33. </NTabPane>
  34. <NTabPane
  35. name="shareResources"
  36. tab="共享资源"
  37. displayDirective="show:lazy">
  38. <SelectItem type="shareResources" />
  39. </NTabPane>
  40. <NTabPane
  41. name="myCollect"
  42. tab="我的收藏"
  43. displayDirective="show:lazy">
  44. <SelectItem type="myCollect" />
  45. </NTabPane>
  46. </NTabs>
  47. </div>
  48. );
  49. }
  50. });