大华大屏

This commit is contained in:
yanran200730
2022-05-13 18:02:31 +08:00
parent 69ea4af045
commit ca4a465312

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="dh-video"> <div class="dh-video" style="height: 100%;">
<video :id="id" autoplay class="video-js vjs-default-skin" style="width: 100%; height: 100%;" controls> <video :id="id" autoplay class="video-js vjs-default-skin" style="width: 100%; height: 100%;" controls>
<source :src="src"> <source :src="src">
</video> </video>
@@ -16,7 +16,8 @@
data () { data () {
return { return {
id: `video-${Math.ceil(Math.random() * 10000)}` isInit: false,
id: `video-${Math.ceil(Math.random() * 1000000)}`
} }
}, },
@@ -31,6 +32,7 @@
}) })
} }
}, },
immediate: true,
deep: true deep: true
} }
}, },
@@ -40,7 +42,10 @@
this.$nextTick(() => { this.$nextTick(() => {
videojs(this.id, { videojs(this.id, {
autoplay: true autoplay: true
}, function () { console.log('videojs播放器初始化成功') }) }, function () {
this.isInit = true
console.log('videojs播放器初始化成功')
})
}) })
} }
} }