<template>
  <img v-if="type === 'image'" :src="src" alt="">
  <video v-else-if="type === 'video'" controls="controls" preload>
    <source :src="src" type="video/mp4">
    <p>暂不支持预览</p>
  </video>
</template>

<script>
export default {
  name: 'File',
  props: {
    type: {
      type: String,
      default: 'image'
    },
    src: {
      type: String,
      default: ''
    }
  }
}
</script>
