简介:本文是一个用结合vant制作的一个视频播放功能的页面。
效果展示
<template>
<div class="video-page">
<van-nav-bar
title="视频"
left-text="返回"
left-arrow
@click-left="onClickLeft"
/>
<div class="video-container">
<video controls :src="src"></video>
</div>
</div>
</template>
<script>
import axios from "axios";
export default {
data() {
return {
id: "",
src: null,
};
},
methods: {
onClickLeft() {
this.$router.push("/point");
},
},
mounted() {
console.log("id:" + this.$route.query.id);
this.id = this.$route.query.id;
axios
.get(`http://localhost:8083/video/${this.id}`)
.then((res) => {
this.src = res.data.data.src;
})
.catch((error) => {
console.log(error);
});
},
};
</script>
<style scoped>
.video-page {
height: 100%;
}
.video-container {
display: flex;
justify-content: center;
align-items: center;
height: calc(100% - 44px);
}
video {
max-width: 100%;
outline: none;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
border-radius: 8px;
}
</style>
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有