This commit is contained in:
yanran200730
2022-04-22 16:09:07 +08:00
parent 9c0685e4ff
commit 17c74dd956
2 changed files with 7 additions and 12 deletions

View File

@@ -12,7 +12,7 @@
<script>
export default {
props: ['times'],
props: ['times', 'deviceId'],
data () {
return {
@@ -21,7 +21,7 @@
canvasHeight: '',
isInit: false,
wrapper: `canvas-${new Date().getTime()}`,
id: `timeline-${new Date().getTime()}`,
id: `timeline-${new Date().getTime()}-${this.deviceId}`,
timer: null
}
},
@@ -49,6 +49,10 @@
methods: {
init () {
if (this.ctx) {
this.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight)
}
this.isInit = false
this.$nextTick(() => {
this.isInit = true
this.$nextTick(() => {
@@ -60,16 +64,7 @@
this.ctx = el.getContext('2d')
this.ctx.width = document.querySelector('.canvas').offsetWidth
this.ctx.height = document.querySelector('.canvas').offsetHeight
if (this.x > 0) {
// this.x = this.canvasWidth * this.ratioW
} else {
// this.initNowTime()
}
this.renderPlayback()
// this.countdown()
})
})
})

View File

@@ -58,7 +58,7 @@
<div class="playback-item" v-for="(item, index) in times" :key="index">
<el-checkbox :label="item.id">
<span>通道{{ index + 1 }}</span>
<PlaybackTime class="playback-item__timeline" :key="'PlaybackTime' + index" :times="item.times"></PlaybackTime>
<PlaybackTime class="playback-item__timeline" :key="'PlaybackTime' + index" v-if="item.times.length" :deviceId="item.id" :times="item.times"></PlaybackTime>
</el-checkbox>
</div>
</el-checkbox-group>