|
2 | 2 | <transition name="vac-slide-up">
|
3 | 3 | <div
|
4 | 4 | v-if="files.length"
|
5 |
| - class="vac-files-container" |
| 5 | + class="vac-room-files-container" |
6 | 6 | :style="{ bottom: `${$parent.$refs.roomFooter.clientHeight}px` }"
|
7 | 7 | >
|
8 | 8 | <div class="vac-files-box">
|
9 | 9 | <div v-for="(file, i) in files" :key="i">
|
10 |
| - <div class="vac-media-container"> |
11 |
| - <div |
12 |
| - class="vac-svg-button vac-icon-remove" |
13 |
| - @click="$emit('remove-file', i)" |
14 |
| - > |
15 |
| - <slot name="image-close-icon"> |
16 |
| - <svg-icon name="close" param="image" /> |
17 |
| - </slot> |
18 |
| - </div> |
19 |
| - |
20 |
| - <div |
21 |
| - v-if="isImageFile(file)" |
22 |
| - class="vac-message-image" |
23 |
| - :style="{ |
24 |
| - 'background-image': `url('${file.localUrl || file.url}')` |
25 |
| - }" |
26 |
| - /> |
27 |
| - |
28 |
| - <video v-else-if="isVideoFile(file)" controls> |
29 |
| - <source :src="file.localUrl || file.url" /> |
30 |
| - </video> |
31 |
| - |
32 |
| - <div v-else class="vac-file-container"> |
33 |
| - <div class="vac-icon-file"> |
34 |
| - <slot name="file-icon"> |
35 |
| - <svg-icon name="file" /> |
36 |
| - </slot> |
37 |
| - </div> |
38 |
| - <div class="vac-text-ellipsis"> |
39 |
| - {{ file.name }} |
40 |
| - </div> |
41 |
| - <div |
42 |
| - v-if="file.extension" |
43 |
| - class="vac-text-ellipsis vac-text-extension" |
44 |
| - > |
45 |
| - {{ file.extension }} |
46 |
| - </div> |
47 |
| - </div> |
48 |
| - </div> |
| 10 | + <room-file |
| 11 | + :file="file" |
| 12 | + :index="i" |
| 13 | + @remove-file="$emit('remove-file', $event)" |
| 14 | + /> |
49 | 15 | </div>
|
50 | 16 | </div>
|
51 | 17 |
|
|
63 | 29 | <script>
|
64 | 30 | import SvgIcon from '../../../components/SvgIcon/SvgIcon'
|
65 | 31 |
|
66 |
| -const { isImageFile, isVideoFile } = require('../../../utils/media-file') |
| 32 | +import RoomFile from '../RoomFile/RoomFile' |
67 | 33 |
|
68 | 34 | export default {
|
69 | 35 | name: 'RoomFiles',
|
70 | 36 | components: {
|
71 |
| - SvgIcon |
| 37 | + SvgIcon, |
| 38 | + RoomFile |
72 | 39 | },
|
73 | 40 |
|
74 | 41 | props: {
|
75 | 42 | files: { type: Array, required: true }
|
76 | 43 | },
|
77 | 44 |
|
78 |
| - emits: ['remove-file', 'reset-message'], |
79 |
| -
|
80 |
| - methods: { |
81 |
| - isImageFile(file) { |
82 |
| - return isImageFile(file) |
83 |
| - }, |
84 |
| - isVideoFile(file) { |
85 |
| - return isVideoFile(file) |
86 |
| - } |
87 |
| - } |
| 45 | + emits: ['remove-file', 'reset-message'] |
88 | 46 | }
|
89 | 47 | </script>
|
0 commit comments