Browse Source

Pull request #1535: 无JIRA fix: 修复attributes覆盖问题

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit 'e445120f834ce5de2b21bc6c577a5e1451bbbcf3':
  无JIRA fix: 修复iframe attributes 问题
  无JIRA fix: 修复attributes覆盖问题  _initProps   this.options = extend(this._defaultConfig(config), props, config); 是浅extend
  无JIRA fix: 修复iframe attributes 问题
es6
guy 4 years ago
parent
commit
ca0e90b49d
  1. 16
      src/base/single/iframe/iframe.js
  2. 10
      src/base/single/img/img.js

16
src/base/single/iframe/iframe.js

@ -12,11 +12,7 @@ BI.Iframe = BI.inherit(BI.Single, {
baseCls: (conf.baseCls || "") + " bi-iframe", baseCls: (conf.baseCls || "") + " bi-iframe",
src: "", src: "",
name: "", name: "",
attributes: { attributes: {},
frameborder: 0,
src: config.src,
name: config.name
},
width: "100%", width: "100%",
height: "100%" height: "100%"
}); });
@ -30,6 +26,16 @@ BI.Iframe = BI.inherit(BI.Single, {
}); });
}, },
_initProps: function () {
BI.Iframe.superclass._initProps.apply(this, arguments);
var o = this.options;
this.options.attributes = BI.extend({
frameborder: 0,
src: o.src,
name: o.name
}, this.options.attributes);
},
setSrc: function (src) { setSrc: function (src) {
this.options.src = src; this.options.src = src;
this.element.attr("src", src); this.element.attr("src", src);

10
src/base/single/img/img.js

@ -13,12 +13,20 @@ BI.Img = BI.inherit(BI.Single, {
tagName: "img", tagName: "img",
baseCls: (conf.baseCls || "") + " bi-img display-block", baseCls: (conf.baseCls || "") + " bi-img display-block",
src: "", src: "",
attributes: config.src ? {src: config.src} : {}, attributes: config.src ? { src: config.src } : {},
width: "100%", width: "100%",
height: "100%" height: "100%"
}); });
}, },
_initProps: function () {
BI.Img.superclass._initProps.apply(this, arguments);
var o = this.options;
this.options.attributes = BI.extend({
src: o.src
}, this.options.attributes);
},
setSrc: function (src) { setSrc: function (src) {
this.options.src = src; this.options.src = src;
this.element.attr("src", src); this.element.attr("src", src);

Loading…
Cancel
Save