From d84283821bb08d81d887f20a7118caf25b8b2714 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期二, 27 八月 2024 18:29:10 +0800 Subject: [PATCH] 判断接口返回值是否是字符串,然后解析 --- pages/modal/3200_view.vue | 34 ++++++++++++++++++---------------- 1 files changed, 18 insertions(+), 16 deletions(-) diff --git a/pages/modal/3200_view.vue b/pages/modal/3200_view.vue index 5b6b485..224ea62 100644 --- a/pages/modal/3200_view.vue +++ b/pages/modal/3200_view.vue @@ -267,24 +267,26 @@ $this.$data.detail2_styledef = ret.result.style_def ? JSON.parse(styledef) : {}; $this.$data.detail2_styledef.SelBut_Checked = false; // console.log($this.$data.detail2_styledef); - $this.styleDef.form.attrs.forEach((attr) => { - // info[attr.name]=attr.value; - $this.detail2_styledef.form.items.forEach(async (ele, index) => { - if (ele.name != 'Layout') { - if (ele.fieldId == attr.name) { - ele.value = attr.value; - } - } else if (ele.name == 'Layout') { - ele.setting.colList.forEach(async (col, key) => { - if (col) { - if (col.fieldId == attr.name) { - col.value = attr.value; - } + if ($this.detail2_styledef.form?.items) { + $this.styleDef.form.attrs.forEach((attr) => { + // info[attr.name]=attr.value; + $this.detail2_styledef.form.items.forEach(async (ele, index) => { + if (ele.name != 'Layout') { + if (ele.fieldId == attr.name) { + ele.value = attr.value; } - }); - } + } else if (ele.name == 'Layout') { + ele.setting.colList.forEach(async (col, key) => { + if (col) { + if (col.fieldId == attr.name) { + col.value = attr.value; + } + } + }); + } + }); }); - }); + } setTimeout(function() { var detail2_styledef = JSON.parse(JSON.stringify($this.detail2_styledef)); $this.detail2_styledef = []; -- Gitblit v1.9.1