fix: bug
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
<template>
|
||||
<view class="video-view-box">
|
||||
<video class="video-cont" v-if="fileUrlShow" :src="fileUrlShow" controls></video>
|
||||
<view class="video-view-box" @click="showModel = true">
|
||||
播放
|
||||
<uv-overlay :show="showModel" opacity=".6" @click="showModel = false">
|
||||
<view class="overlay-box">
|
||||
<video class="video-cont-center" v-if="showModel && fileUrlShow" :src="fileUrlShow" controls @error="playError" object-fit="contain"></video>
|
||||
</view>
|
||||
</uv-overlay>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -17,6 +22,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showModel: false,
|
||||
fileUrlShow:'',
|
||||
watching:false
|
||||
};
|
||||
@@ -30,7 +36,7 @@
|
||||
watch: {
|
||||
fileId: {
|
||||
handler(newval, oldval) {
|
||||
if(newval.indexOf('http:') === 0){
|
||||
if(newval.indexOf('http') === 0){
|
||||
this.fileUrlShow = newval
|
||||
return
|
||||
}
|
||||
@@ -43,6 +49,9 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
playError(info){
|
||||
console.log('err:',info)
|
||||
},
|
||||
getPreviewUrlBlob(id) {
|
||||
if (!id) {
|
||||
this.fileUrlShow = ''
|
||||
@@ -60,8 +69,9 @@
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.fileId)
|
||||
if (this.fileId) {
|
||||
if(this.fileId.indexOf('http:') === 0){
|
||||
if(this.fileId.indexOf('http') === 0){
|
||||
this.fileUrlShow = this.fileId
|
||||
}else{
|
||||
this.getPreviewUrlBlob(this.fileId);
|
||||
@@ -72,13 +82,22 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="scss" scoped>
|
||||
.video-view-box{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #eee;
|
||||
}
|
||||
.video-view-box .video-cont{
|
||||
.overlay-box .video-cont-center{
|
||||
max-width: 100%;
|
||||
max-height: 80%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.overlay-box{
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user