media.jsx 518 B

123456789101112131415
  1. import { computed } from 'vue'
  2. import CipDynamicImage from '@cip/components/cip-dynamic-image'
  3. import CipDynamicVideo from '@cip/components/cip-dynamic-video'
  4. export default {
  5. props: {
  6. type: { type: String, default: 'image', validate: (val) => ['video', 'image'].includes(val) },
  7. src: String
  8. },
  9. setup (props) {
  10. const Component = computed(() => {
  11. return props.type === 'video' ? CipDynamicVideo : CipDynamicImage
  12. })
  13. return () => <Component.value src={props.src}></Component.value>
  14. }
  15. }