|
|
@ -12122,7 +12122,33 @@ _.extend(BI.OB.prototype, { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
BI.mount = function (widget, container, predicate) { |
|
|
|
BI.mount = function (widget, container, predicate, hydrate) { |
|
|
|
|
|
|
|
if(hydrate === true){ |
|
|
|
|
|
|
|
// 将widget的element元素都挂载好,并建立相互关系
|
|
|
|
|
|
|
|
var res = widget._mount(true, false, false, function(w){ |
|
|
|
|
|
|
|
var ws = w.element.data("__widgets"); |
|
|
|
|
|
|
|
if(!ws) { |
|
|
|
|
|
|
|
ws = []; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ws.push(w); |
|
|
|
|
|
|
|
w.element.data("__widgets", ws); |
|
|
|
|
|
|
|
predicate && predicate.apply(this, arguments); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// 将新的dom树属性(事件等)patch到已存在的dom上
|
|
|
|
|
|
|
|
var c = BI.Widget._renderEngine.createElement; |
|
|
|
|
|
|
|
BI.DOM.patchProps(widget.element, c(c(container).children()[0])); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var triggerLifeHook = function (w) { |
|
|
|
|
|
|
|
w.beforeMount && w.beforeMount(); |
|
|
|
|
|
|
|
w.mounted && w.mounted(); |
|
|
|
|
|
|
|
BI.each(w._children, function (i, child) { |
|
|
|
|
|
|
|
triggerLifeHook(child); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
//最后触发组件树生命周期函数
|
|
|
|
|
|
|
|
triggerLifeHook(widget); |
|
|
|
|
|
|
|
return res; |
|
|
|
|
|
|
|
} |
|
|
|
if (container) { |
|
|
|
if (container) { |
|
|
|
BI.Widget._renderEngine.createElement(container).append(widget.element); |
|
|
|
BI.Widget._renderEngine.createElement(container).append(widget.element); |
|
|
|
} |
|
|
|
} |
|
|
@ -18497,9 +18523,30 @@ BI.prepares.push(function () { |
|
|
|
* 对DOM操作的通用函数 |
|
|
|
* 对DOM操作的通用函数 |
|
|
|
* @type {{}} |
|
|
|
* @type {{}} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
BI.DOM = {}; |
|
|
|
!(function () { |
|
|
|
BI.extend(BI.DOM, { |
|
|
|
BI.DOM = {}; |
|
|
|
|
|
|
|
BI.extend(BI.DOM, { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
patchProps: function (fromElement, toElement) { |
|
|
|
|
|
|
|
var elemData = jQuery._data(fromElement[0]); |
|
|
|
|
|
|
|
var events = elemData.events; |
|
|
|
|
|
|
|
BI.each(events, function (eventKey, event) { |
|
|
|
|
|
|
|
var handlers = event.handlers; |
|
|
|
|
|
|
|
BI.each(handlers, function (i, handler) { |
|
|
|
|
|
|
|
toElement.on(eventKey, handler); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
var fromChildren = fromElement.children(), toChildren = toElement.children(); |
|
|
|
|
|
|
|
if(fromChildren.length !== toChildren.length) { |
|
|
|
|
|
|
|
throw new Error("不匹配"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BI.each(fromChildren, function (i, child) { |
|
|
|
|
|
|
|
BI.DOM.patchProps(jQuery(child), jQuery(toChildren[i])); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
BI.each(fromElement.data("__widgets"), function (i, widget) { |
|
|
|
|
|
|
|
widget.element = toElement; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 把dom数组或元素悬挂起来,使其不对html产生影响 |
|
|
|
* 把dom数组或元素悬挂起来,使其不对html产生影响 |
|
|
|
* @param dom |
|
|
|
* @param dom |
|
|
@ -18746,7 +18793,8 @@ BI.extend(BI.DOM, { |
|
|
|
param: param |
|
|
|
param: param |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
});BI.EventListener = { |
|
|
|
}); |
|
|
|
|
|
|
|
})();BI.EventListener = { |
|
|
|
listen: function listen (target, eventType, callback) { |
|
|
|
listen: function listen (target, eventType, callback) { |
|
|
|
if (target.addEventListener) { |
|
|
|
if (target.addEventListener) { |
|
|
|
target.addEventListener(eventType, callback, false); |
|
|
|
target.addEventListener(eventType, callback, false); |
|
|
@ -35216,12 +35264,12 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons |
|
|
|
defineProps(this, keys); |
|
|
|
defineProps(this, keys); |
|
|
|
childContext && defineContext(this, childContext); |
|
|
|
childContext && defineContext(this, childContext); |
|
|
|
this.$$model && (this.model.__ob__ = this.$$model.__ob__); |
|
|
|
this.$$model && (this.model.__ob__ = this.$$model.__ob__); |
|
|
|
|
|
|
|
initMixins(this, mixins); |
|
|
|
this._init(); |
|
|
|
this._init(); |
|
|
|
initState(this, state); |
|
|
|
initState(this, state); |
|
|
|
initMixins(this, mixins); |
|
|
|
|
|
|
|
initMethods(this, actions); |
|
|
|
|
|
|
|
initComputed(this, computed); |
|
|
|
initComputed(this, computed); |
|
|
|
initWatch(this, watch$$1); |
|
|
|
initWatch(this, watch$$1); |
|
|
|
|
|
|
|
initMethods(this, actions); |
|
|
|
this.created && this.created(); |
|
|
|
this.created && this.created(); |
|
|
|
if (this.$$model) { |
|
|
|
if (this.$$model) { |
|
|
|
return this.model; |
|
|
|
return this.model; |
|
|
|