mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
23 lines
756 B
TypeScript
23 lines
756 B
TypeScript
import type { Ref } from 'vue'
|
|
import { defineComponent, h, computed, ref } from 'vue'
|
|
import type { DownloadVideoInputItem } from '../types'
|
|
import EpisodesPicker from './EpisodesPicker.vue'
|
|
|
|
export interface EpisodeItem {
|
|
key: string
|
|
title: string
|
|
isChecked: boolean
|
|
inputItem: DownloadVideoInputItem
|
|
durationText?: string
|
|
}
|
|
export const createEpisodesPicker = (
|
|
fetchEpisodeItems: (instance: any) => Promise<EpisodeItem[]>,
|
|
) =>
|
|
defineComponent({
|
|
setup: (props, { expose }) => {
|
|
const picker = ref(null) as Ref<InstanceType<typeof EpisodesPicker> | null>
|
|
expose({ checkedInputItems: computed(() => picker.value.checkedInputItems) })
|
|
return () => h(EpisodesPicker, { api: fetchEpisodeItems, ref: picker })
|
|
},
|
|
})
|