Browse Source

refactor: 美化代码

es6
iapyang 5 years ago
parent
commit
09fed9a3a3
  1. 13
      src/core/ob.js
  2. 4
      src/core/shortcut.js

13
src/core/ob.js

@ -29,16 +29,15 @@
* @abstract
*/
BI.OB = function (config) {
this.__config = config;
this._constructor();
this._constructor(config);
};
_.extend(BI.OB.prototype, {
props: {},
init: null,
destroyed: null,
_constructor: function () {
this._initProps();
_constructor: function (config) {
this._initProps(config);
this._init();
this._initRef();
},
@ -47,12 +46,12 @@
return {};
},
_initProps: function () {
_initProps: function (config) {
var props = this.props;
if (BI.isFunction(this.props)) {
props = this.props(this.__config);
props = this.props(config);
}
this.options = extend(this._defaultConfig(this.__config), props, this.__config);
this.options = extend(this._defaultConfig(config), props, config);
},
_init: function () {

4
src/core/shortcut.js

@ -11,9 +11,9 @@
var createWidget = function (config) {
var cls = kv[config.type];
var widget = new cls(config);
var widget = new cls();
widget._initProps();
widget._initProps(config);
widget._init();
widget._initRef();

Loading…
Cancel
Save