解决文件上传无法播放问题

This commit is contained in:
神仙都没用 2023-12-15 12:26:11 +08:00
parent bd6ae251e4
commit c8582a7547
3 changed files with 19 additions and 12 deletions

View File

@ -424,6 +424,7 @@ const Table = useTable({
dict: dict.get("occupation"),
dictColor: true,
minWidth: 150,
dictAllLevels: true, //
//
search: {

View File

@ -22,8 +22,8 @@
</template>
<!-- 视频 -->
<template v-else-if="item.type === 'video' && item.url">
<video :ref="setRefs('video')" :src="item.url" />
<template v-else-if="item.type === 'video'">
<video :ref="setRefs('video')" :src="item.url" :key="item.url" />
</template>
<!-- 其他 -->
@ -42,7 +42,7 @@
<!-- 音频 -->
<template v-if="item.type === 'audio'">
<audio controls :ref="setRefs('audio')">
<source :src="item.url" type="audio/mpeg" />
<source :src="item.url" type="audio/mpeg" :key="item.url" />
</audio>
</template>
@ -220,25 +220,31 @@ const media = reactive({
}
//
const el = refs[props.item.type!];
let el: HTMLVideoElement | HTMLAudioElement | undefined;
// \
watch(
() => props.item.isPlay,
(val) => {
if (val) {
el.play();
} else {
el.pause();
}
}
);
if (!el) {
el = refs[props.item.type!];
console.log(el);
//
el?.addEventListener("ended", () => {
media.pause();
});
}
if (val) {
el?.play();
} else {
el?.pause();
}
}
);
}
});
onMounted(() => {

File diff suppressed because one or more lines are too long