refs #323 Show image as a picture if the extension is unknown in Media

This commit is contained in:
AkiraFukushima 2018-05-21 09:18:37 +09:00
parent adf6c83d61
commit 9b5e92b23e
1 changed files with 2 additions and 5 deletions

View File

@ -1,6 +1,6 @@
<template>
<img :src="src" v-if="isImageFile()">
<video :src="src" v-else-if="isMovieFile()" controls></video>
<video :src="src" v-if="isMovieFile()" controls></video>
<img :src="src" v-else>
</template>
<script>
@ -12,9 +12,6 @@ export default {
file_ext () {
return this.src.split('.').pop().toLowerCase()
},
isImageFile () {
return ['jpg', 'gif', 'png'].indexOf(this.file_ext()) >= 0
},
isMovieFile () {
return ['mp4'].indexOf(this.file_ext()) >= 0
}