<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="handleClick"> <el-tab-pane label="海康" name="hk"> <iframe v-if="activeName === 'hk'" name="playHK" class="iframe-body" src="/static/webCtrl/hk/demo_window_simple_preview.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' } }, mounted() { }, 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.ip === 'undefined' || camera.ip === '') { console.log('ip is null') return false } else { if (this.activeName === 'hk') { window.frames['playHK'].preview(camera.ip) } else if (this.activeName === 'hk') { window.frames['playNVR'].startPlayReal() } } if (typeof camera.username === 'undefined' || camera.username === '') { console.log('username is null') return false } if (typeof camera.password === 'undefined' || camera.password === '') { console.log('password is null') return false } // 开始预览 this.$refs.webCtrl.$refs.play.contentWindow.startPlayReal(camera) } } } </script> <style scoped> .iframe-body{ height: calc(100vh - 250px); width: 100%; frameBorder: 0; scrolling: no; border: 0; vspale: 0; } </style>