<template> <div> <el-row> <el-col :span="6"> <video-tree @click="handleCameraClicked"/> </el-col> <el-col :span="18"> <div style="margin-top: 14px"> <el-tabs v-model="activeName" type="border-card" @tab-click.once ="handleClick"> <el-tab-pane label="海康" name="hk"> <iframe v-if="activeName === 'hk'" name="playHK" class="iframe-body" src="/static/webCtrl/hk/demo_embedded_for_iframe.html"/> </el-tab-pane> <el-tab-pane label="NVR" name="nvr"> <iframe v-if="activeName==='nvr'" name="playNVR" class="iframe-body" src="/static/webCtrl/nvr/demo-easy.html"/> </el-tab-pane> </el-tabs> </div> </el-col> </el-row> </div> </template> <script> import VideoTree from './videoTree' import WebPlay from './webPlay' export default { name: 'VideoMonitor', components: { WebPlay, VideoTree }, data() { return { activeName: 'hk', winHeight: '', winWidth: '' } }, mounted() { window.frames['playHK'].initPlugin() // window.frames['playHK'].initBtnClicked() }, activated() { }, methods: { handleClick(tab, event) { if (tab.name === 'hk') { this.activeName = 'hk' window.frames['playHK'].initPlugin() } else if (tab.name === 'nvr') { // window.frames['playHK'].close() this.activeName = 'nvr' window.frames['playNVR'].stopPlayReal(null) } }, handleCameraClicked(camera) { console.log(camera) if (typeof camera.monitorPoint === 'undefined' || camera.monitorPoint === '') { console.log('monitorPoint is null') return false } else { if (this.activeName === 'hk') { // window.frames['playHK'].preview('2a617f752fbe4c68989e8d3975cf58f9') // this.$message.info('监控点编号:' + camera.monitorPoint) window.frames['playHK'].play(camera.monitorPoint) } else if (this.activeName === 'nvr') { window.frames['playNVR'].startPlayReal() } } } } } </script> <style scoped> .iframe-body{ height: calc(100vh - 250px); width: 100%; /*frameBorder: 0;*/ scrolling: no; border: 1px; vspale: 0; } </style>