From 6ec99d0da0ff993fe345fe5ffe73e82b02007da9 Mon Sep 17 00:00:00 2001 From: zsmj1994 Date: Mon, 12 Oct 2020 10:44:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=20fix:=20=E4=BF=AE=E5=A4=8Dattrib?= =?UTF-8?q?utes=E8=A6=86=E7=9B=96=E9=97=AE=E9=A2=98=20=20=5FinitProps=20?= =?UTF-8?q?=20=20this.options=20=3D=20extend(this.=5FdefaultConfig(config)?= =?UTF-8?q?,=20props,=20config);=20=E6=98=AF=E6=B5=85extend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/iframe/iframe.js | 8 +++++--- src/base/single/img/img.js | 7 ++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/base/single/iframe/iframe.js b/src/base/single/iframe/iframe.js index 69d131b65..d87265708 100644 --- a/src/base/single/iframe/iframe.js +++ b/src/base/single/iframe/iframe.js @@ -20,10 +20,12 @@ BI.Iframe = BI.inherit(BI.Single, { _init: function () { var self = this, o = this.options; - o.attributes.frameborder = "0"; - o.attributes.src = o.src; - o.attributes.name = o.name; BI.Iframe.superclass._init.apply(this, arguments); + this.element.attr(BI.extend({ + frameborder: 0, + src: o.src, + name: o.name + }, o.attributes)); this.element.on("load", function () { self.fireEvent("EVENT_LOADED"); }); diff --git a/src/base/single/img/img.js b/src/base/single/img/img.js index e54306b11..670b16649 100644 --- a/src/base/single/img/img.js +++ b/src/base/single/img/img.js @@ -13,12 +13,17 @@ BI.Img = BI.inherit(BI.Single, { tagName: "img", baseCls: (conf.baseCls || "") + " bi-img display-block", src: "", - attributes: config.src ? {src: config.src} : {}, + attributes: config.src ? { src: config.src } : {}, width: "100%", height: "100%" }); }, + _init: function () { + BI.Img.superclass._init.apply(this, arguments); + this.setSrc(this.options.src); + }, + setSrc: function (src) { this.options.src = src; this.element.attr("src", src);