<template>
  <div>
    <iframe
        id = "iframe"
        ref="fIframe"
        scrolling="no"
        frameborder ="0"
        width="100%"
        height="100%"
        src="/hk/index.html"     
        >
    </iframe>
  </div>
</template>

<script>
  export default {
    name: 'monitor',
    props:["monitorInfo"],
    data(){
        return {

        }
    },
    mounted(){
        let arr = [
            this.monitorInfo.cameraindexcode,
            this.monitorInfo.cameraindexcode,
            "23604396",
            "221.2.83.54",
            1443,
            "NZJ8L3bxCOOV6rtTFjsx"
        ]

        let _this = this;

        this.$refs.fIframe.onload = function () {
            _this.$refs.fIframe.contentWindow.postMessage(arr)
        }

        window.addEventListener('message', (e)=>{
            this.$emit("closeMonitor")
        })
    }
  }
</script>

<style scoped>
  
</style>