fix: 修复chartUrl报错问题

This commit is contained in:
@changcode
2021-12-06 16:41:32 +08:00
parent b4954bbdb1
commit 793b03a0cb
2 changed files with 7 additions and 5 deletions

View File

@@ -66,6 +66,10 @@
.el-input-number--small {
width: 100%;
}
.el-tag--mini.el-tag--light {
background-color: $--background-color-base;
border-color: $--border-color-light;
}
}
.severity-item{
color: $--color-text-secondary;

View File

@@ -1,6 +1,6 @@
<template>
<div style="width: 100%;height: 100%" :id="'chartUrl' + chartInfo.type" class="mt-10 url-container" v-show="firstShow">
<iframe :id="'urlContainer' + chartInfo.type" frameborder="0" width="100%" height="100%" name="showHere" scrolling=auto style="z-index:5000;padding-bottom:6px;"></iframe>
<div style="width: 100%;height: 100%" :id="'chartUrl' + chartInfo.id" class="mt-10 url-container" v-show="firstShow">
<iframe :id="'urlContainer' + chartInfo.id" frameborder="0" width="100%" height="100%" name="showHere" scrolling=auto style="z-index:5000;padding-bottom:6px;"></iframe>
</div>
</template>
@@ -20,21 +20,19 @@ export default {
setLoadFrame (data) {
const that = this
this.$nextTick(() => {
const iframe = document.querySelector('#urlContainer' + this.chartInfo.type)
const iframe = document.querySelector('#urlContainer' + this.chartInfo.id)
// 处理兼容行问题
if (iframe.attachEvent) {
iframe.attachEvent('onload', function () {
// iframe加载完毕以后执行操作
that.firstShow = true
// console.log('iframe已加载完毕');
that.endLoading()
})
} else {
iframe.onload = function () {
// iframe加载完毕以后执行操作
that.firstShow = true
// console.log('iframe已加载完毕');
that.endLoading()
}
}
iframe.src = data