import { NModal } from 'naive-ui'; import { defineComponent, toRef, watch } from 'vue'; import styles from './index.module.less'; import VideoModal from './video-modal'; import MusicModal from './music-modal'; import SongModal from './song-modal'; import TheEmpty from '../TheEmpty'; export default defineComponent({ name: 'card-preview', props: { show: { type: Boolean, default: false }, item: { type: Object, default: () => ({}) } }, emit: ['update:show'], setup(props, { emit }) { const show = toRef(props.show); const item = toRef(props.item); watch( () => props.show, () => { show.value = props.show; } ); watch( () => props.item, () => { item.value = props.item; } ); return () => ( <> { emit('update:show', show.value); }} preset="card" showIcon={false} class={['modalTitle background', styles.cardPreview]} title={item.value.title} blockScroll={false}> {item.value.type === 'VIDEO' && ( )} {item.value.type === 'MUSIC' && } {item.value.type === 'SONG' && } {!['VIDEO', 'MUSIC', 'SONG'].includes(item.value.type) && ( )} ); } });