..
[1124498879]
2021-06-07 0eb8d716ee0f9a952ada4e0e15a96aa2c9866156
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<template>
  <div v-loading="loading" :style="'height:'+ height">
    <div class="app-container" style="width: 100%;height: 100%">
      <el-row style="margin: 5px 0">
        <el-input v-model="url" :placeholder="$t('common.pleaseInputUrl')" style="width: 50%" />
        &nbsp;
        <el-button type="success" plain @click="refresh">{{ $t('table.refresh') }}</el-button>
        <el-button type="info" plain @click="openInNewPage">{{ $t('table.openInNewPage') }}</el-button>
      </el-row>
      <iframe :src="src" frameborder="no" style="width: 100%;height: 91%" scrolling="auto" />
    </div>
  </div>
</template>
<script>
export default {
  props: {
    src: {
      type: String,
      required: true
    }
  },
  data() {
    return {
      height: document.documentElement.clientHeight - 87.7 + 'px',
      loading: true,
      url: this.src
    }
  },
  mounted: function() {
    setTimeout(() => {
      this.loading = false
    }, 500)
    window.onresize = () => {
      this.height = document.documentElement.clientHeight - 87.7 + 'px'
    }
  },
  methods: {
    refresh() {
      this.$emit('refresh', this.url)
    },
    openInNewPage() {
      window.open(this.url, '_blank')
    }
  }
}
</script>
<style lang="scss" scoped>
  .app-container {
    margin: 0;
    padding: 5px;
  }
</style>