VideoModal.vue
1.21 KB
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
<template>
<a-modal :visible="visible" @cancel="handleClose" @ok="handleClose" title="流程演示">
<div>
<!-- 添加 autoplay 和 muted 属性来确保视频自动播放 -->
<video :src="videoUrl" controls autoplay muted></video>
<p>{{ videoDescription }}</p>
</div>
<!-- 将确定和取消按钮替换为一个“已完成学习”按钮 -->
<template #footer>
<a-button type="primary" @click="handleComplete">已学习</a-button>
</template>
</a-modal>
</template>
<script>
export default {
props: {
visible: {
type: Boolean,
required: true
},
videoUrl: {
type: String,
default: ''
},
videoDescription: {
type: String,
default: ''
}
},
methods: {
handleClose() {
this.$emit('update:visible', false); // 关闭模态框时通知父组件
},
// 点击“已完成学习”按钮后的处理逻辑
handleComplete() {
this.$emit('update:visible', false); // 关闭模态框
this.$emit('completed'); // 触发已完成学习的事件
},
}
};
</script>
<style scoped>
/* 添加一些自定义样式,例如视频大小调整 */
video {
max-width: 100%;
height: auto;
}
</style>