Browse Source

无JIRA任务,添加一个设置背景图片的组件

es6
dailer 6 years ago
parent
commit
a320b39c84
  1. 30
      src/base/single/backgroundimage/background.image.js
  2. 5
      src/less/base/single/backgroundimage/background.image.less

30
src/base/single/backgroundimage/background.image.js

@ -0,0 +1,30 @@
/**
* 用于设置背景图的区域
* @class BI.BackgroundImage
* @extends BI.Single
*/
BI.BackgroundImage = BI.inherit(BI.Single, {
props: {
baseCls: "bi-background-image",
url: "",
width: "100%",
height: "100%"
},
render: function () {
this.setUrl(this.options.url);
},
setUrl: function (url) {
this.options.url = url;
this.element.css({
"background-image": "url(" + url + ")"
});
},
getUrl: function () {
return this.options.url;
}
});
BI.shortcut("bi.background_image", BI.BackgroundImage);

5
src/less/base/single/backgroundimage/background.image.less

@ -0,0 +1,5 @@
.bi-background-image {
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
}
Loading…
Cancel
Save