ZhangXianQiang
2024-07-05 98f494cf633e3acf5c20f3e9de0d708f2a6c2045
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<template>
  <div class="video-container">
    <div class="video-content">
      <video :src="props.videoUrl" class="video-player" controls ref="player"></video>
    </div>
  </div>
</template>
 
<script setup>
import {ref, onMounted, onBeforeUnmount} from 'vue';
 
const props = defineProps({
  videoUrl: {
    type: String,
    required: true
  },
  poster: {
    type: String,
    default: ''
  }
});
 
const player = ref(null);
 
 
onMounted(() => {
});
 
onBeforeUnmount(() => {
  player.value.pause();
});
 
</script>
 
<style lang="scss" scoped>
.video-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba($color: #000000, $alpha: 0.5);
  .video-content {
    width: 70%;
    height: 800px;
  }
}
 
.video-player {
  width: 100%;
  height: 100%;
}
</style>