<template>
  <iframe class="hx-iframe" :src="frameSrc"> </iframe>
</template>

<script>
import { getConfigKey } from '@/api/admin/sys-config'
export default {
  props: {
    framePath: String
  },
  created() {
    getConfigKey('v0_base_URL')
      .then((res) => {
        const baseURL = (res && res.data && res.data.configValue) || null
        if (baseURL === null) {
          console.error('get v0 base url failed:', res)
          return
        }
        this.v0BaseURL = baseURL
      })
      .catch((e) => {
        console.error('get v0 base url failed:', e)
      })
  },
  data: function() {
    return {
      v0BaseURL: null
    }
  },
  computed: {
    frameSrc: {
      get: function() {
        if (this.v0BaseURL == null) {
          console.log('no base url')
          return ''
        }
        return this.v0BaseURL + this.framePath
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.hx-iframe {
  width: 100%;
  height: 1000px;
  border: "0px";
}
</style>
