<template>
  <div>
    <iframe
      id="iframe"
      src="/bd_web/security/public/index.html"
      frameborder="0"
      scrolling="no"
      width="100%"></iframe>
  </div>
</template>
<script>
export default {
  data () {
    return {

    }
  },
  mounted () {
    this.iframe()
  },
  activated () {
    this.iframe()
  },
  methods: {
    iframe () {
      let el = document.getElementById('iframe')
      let iframe = document.getElementById('iframe').contentWindow
      el.height = 0
      iframe.onload = () => {
        iframe.document.getElementById('navbar').style.display = 'none'
        iframe.document.getElementById('dynamicBreadcrumbs').style.display = 'none'
        iframe.document.getElementById('sidebar').style.display = 'none'
        iframe.document.getElementById('footer').style.display = 'none'
        const list = iframe.document.getElementsByClassName('nav-list')
        setTimeout(() => {
          list[0].childNodes.forEach(item => {
            if (item.innerText === '库存可视化管理库存图形可视化库存图形可视化配置') {
              item.getElementsByTagName('li')[1].childNodes[0].click()
              iframe.document.getElementById('main-container').removeChild(iframe.document.getElementById('sidebar'))
              el.height = document.documentElement.clientHeight
            }
          })
        }, 800)
      }
    }
  }
}
</script>
