Browse Source

无JIRA fix: 修复attributes覆盖问题

_initProps   this.options = extend(this._defaultConfig(config), props, config); 是浅extend
es6
zsmj1994 4 years ago
parent
commit
6ec99d0da0
  1. 8
      src/base/single/iframe/iframe.js
  2. 7
      src/base/single/img/img.js

8
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");
});

7
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);

Loading…
Cancel
Save