<!-- iframe布局 license by http://eleadmin.com -->
<template>
  <iframe :src="src" frameborder="0" class="ele-admin-iframe"></iframe>
</template>

<script>
export default {
  name: 'EleIframeLayout',
  props: {
    url: String
  },
  data() {
    const current = this.$route, meta = current ? current.meta : null;
    return {
      src: this.url ? this.url : (meta ? meta.iframe : null)
    };
  },
  watch: {
    url() {
      this.src = this.url;
    },
    $route() {
      if (!this.url) {
        const current = this.$route, meta = current ? current.meta : null;
        if (meta && meta.iframe && meta.iframe !== this.src) {
          this.src = meta.iframe;
        }
      }
    }
  }
}
</script>
