+
+
{{data.title}}
-
-
+
@@ -97,6 +102,7 @@ export default {
titleHeight:38,//title-height:28,magrin-bottom:10
paddingBottom:6,
divFirstShow:false,
+ showStatic:false,
};
},
created() {
@@ -105,6 +111,7 @@ export default {
watch: {},
methods: {
showLoad(chartItem) {
+ console.log(chartItem)
this.data = chartItem;
this.panelIdInner = this.panelId;
//设置高度
@@ -119,14 +126,29 @@ export default {
urlBox.style.height = `${height-this.chartSpaceHeight-this.titleHeight-this.paddingBottom}px`;// -75-32
});
this.startLoading();
- this.setLoadFrame();
+
+ if(/\{\{.*?\}\}/g.test(this.data.param.url)){
+ this.showStatic=true;
+ this.setStaticContent();
+ }else{
+ this.showStatic=false;
+ this.setLoadFrame();
+ }
this.divFirstShow = true;
},
+ setStaticContent:function(){
+ let that = this;
+ this.$nextTick(() => {
+ let staticDiv = document.querySelector('#staticContainer'+this.chartIndex);
+ staticDiv.innerHTML=`
${that.data.param.url}
${that.$t('dashboard.panel.chartForm.typeVal.url.staticTip')}
`
+ that.firstShow = true;
+ that.endLoading();
+ });
+ },
setLoadFrame(){
let that = this;
this.$nextTick(() => {
let iframe = document.querySelector('#urlContainer'+this.chartIndex);
-
// 处理兼容行问题
if (iframe.attachEvent) {
iframe.attachEvent('onload', function () {
@@ -143,14 +165,19 @@ export default {
that.endLoading();
}
}
-
iframe.src = that.data.param.url;
});
},
initDialog(){
this.startLoading('screen');
+ if(/\{\{.*?\}\}/g.test(this.data.param.url)){
+ this.showStatic=true;
+ this.setStaticContentFull();
+ }else{
+ this.showStatic=false;
+ this.setLoadFrameFull();
+ }
- this.setLoadFrameFull();
},
dragResize:function(e){
var diffWidth =20; //界面的宽度空白的地方的宽度
@@ -389,6 +416,15 @@ export default {
iframe.src = this.data.param.url;
});
},
+ setStaticContentFull:function(){
+ let that = this;
+ this.$nextTick(() => {
+ let staticDiv = document.querySelector('#staticContainerFull'+this.chartIndex);
+ staticDiv.innerHTML=`
${that.data.param.url}${that.$t('dashboard.panel.chartForm.typeVal.url.staticTip')}`
+ that.firstShow = true;
+ that.endLoading('screen');
+ });
+ },
},
mounted() {
this.firstLoad = false;
@@ -398,3 +434,13 @@ export default {
},
};
+
diff --git a/nezha-fronted/src/components/charts/chartPreview.vue b/nezha-fronted/src/components/charts/chartPreview.vue
index 926b11736..e9b9738f4 100644
--- a/nezha-fronted/src/components/charts/chartPreview.vue
+++ b/nezha-fronted/src/components/charts/chartPreview.vue
@@ -128,6 +128,10 @@