guy 8 years ago
parent
commit
eb0777e04d
  1. 25
      bi/core.js
  2. 25
      dist/core.js
  3. 8
      src/core/mvc/fbi.js
  4. 17
      src/core/view.js

25
bi/core.js

@ -1131,7 +1131,7 @@ BI.Factory = {
_init: function(){},
//容器,默认放在this.element上
_vessel: function(){return this.element},
_vessel: function(){return this},
// **render** is the core function that your view should override, in order
// to populate its element (`this.el`), with the appropriate HTML. The
// convention is for **render** to always return `this`.
@ -1230,21 +1230,21 @@ BI.Factory = {
// using `selector`). This only works for delegate-able events: not `focus`,
// `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.
delegate: function(eventName, selector, listener) {
this.$vessel.on(eventName + '.delegateEvents' + this.cid, selector, listener);
this.$vessel.element.on(eventName + '.delegateEvents' + this.cid, selector, listener);
},
// Clears all callbacks previously bound to the view by `delegateEvents`.
// You usually don't need to use this, but may wish to if you have multiple
// BI views attached to the same DOM element.
undelegateEvents: function() {
if (this.$vessel) this.$vessel.off('.delegateEvents' + this.cid);
if (this.$vessel) this.$vessel.element.off('.delegateEvents' + this.cid);
return this;
},
// A finer-grained `undelegateEvents` for removing a single delegated event.
// `selector` and `listener` are both optional.
undelegate: function(eventName, selector, listener) {
this.$vessel.off(eventName + '.delegateEvents' + this.cid, selector, listener);
this.$vessel.element.off(eventName + '.delegateEvents' + this.cid, selector, listener);
},
// Produces a DOM element to be assigned to your view. Exposed for
@ -5370,7 +5370,7 @@ BI.View = BI.inherit(BI.V, {
});
var vessel = BI.createWidget();
this._cardLayouts[this.getName()].addCardByName(this.getName(), vessel);
return vessel.element;
return vessel;
},
_render: function (vessel) {
@ -5741,15 +5741,26 @@ BI.View = BI.inherit(BI.V, {
},
_unMount: function () {
BI.each(this._cardLayouts, function (name, card) {
card && card._unMount();
});
delete this._cardLayouts;
delete this._cards;
this.off();
this.destroyed();
},
destroy: function () {
BI.each(this._cardLayouts, function (name, card) {
card && card.destroy();
card && card._unMount();
});
delete this._cardLayouts;
delete this._cards;
this.destroyed();
this.remove();
this.trigger(BI.Events.DESTROY);
this.destroyed();
this.off();
},
destroyed: function () {

25
dist/core.js vendored

@ -12147,7 +12147,7 @@ BI.Factory = {
_init: function(){},
//容器,默认放在this.element上
_vessel: function(){return this.element},
_vessel: function(){return this},
// **render** is the core function that your view should override, in order
// to populate its element (`this.el`), with the appropriate HTML. The
// convention is for **render** to always return `this`.
@ -12246,21 +12246,21 @@ BI.Factory = {
// using `selector`). This only works for delegate-able events: not `focus`,
// `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.
delegate: function(eventName, selector, listener) {
this.$vessel.on(eventName + '.delegateEvents' + this.cid, selector, listener);
this.$vessel.element.on(eventName + '.delegateEvents' + this.cid, selector, listener);
},
// Clears all callbacks previously bound to the view by `delegateEvents`.
// You usually don't need to use this, but may wish to if you have multiple
// BI views attached to the same DOM element.
undelegateEvents: function() {
if (this.$vessel) this.$vessel.off('.delegateEvents' + this.cid);
if (this.$vessel) this.$vessel.element.off('.delegateEvents' + this.cid);
return this;
},
// A finer-grained `undelegateEvents` for removing a single delegated event.
// `selector` and `listener` are both optional.
undelegate: function(eventName, selector, listener) {
this.$vessel.off(eventName + '.delegateEvents' + this.cid, selector, listener);
this.$vessel.element.off(eventName + '.delegateEvents' + this.cid, selector, listener);
},
// Produces a DOM element to be assigned to your view. Exposed for
@ -15291,7 +15291,7 @@ BI.View = BI.inherit(BI.V, {
});
var vessel = BI.createWidget();
this._cardLayouts[this.getName()].addCardByName(this.getName(), vessel);
return vessel.element;
return vessel;
},
_render: function (vessel) {
@ -15662,15 +15662,26 @@ BI.View = BI.inherit(BI.V, {
},
_unMount: function () {
BI.each(this._cardLayouts, function (name, card) {
card && card._unMount();
});
delete this._cardLayouts;
delete this._cards;
this.off();
this.destroyed();
},
destroy: function () {
BI.each(this._cardLayouts, function (name, card) {
card && card.destroy();
card && card._unMount();
});
delete this._cardLayouts;
delete this._cards;
this.destroyed();
this.remove();
this.trigger(BI.Events.DESTROY);
this.destroyed();
this.off();
},
destroyed: function () {

8
src/core/mvc/fbi.js

@ -1080,7 +1080,7 @@
_init: function(){},
//容器,默认放在this.element上
_vessel: function(){return this.element},
_vessel: function(){return this},
// **render** is the core function that your view should override, in order
// to populate its element (`this.el`), with the appropriate HTML. The
// convention is for **render** to always return `this`.
@ -1179,21 +1179,21 @@
// using `selector`). This only works for delegate-able events: not `focus`,
// `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.
delegate: function(eventName, selector, listener) {
this.$vessel.on(eventName + '.delegateEvents' + this.cid, selector, listener);
this.$vessel.element.on(eventName + '.delegateEvents' + this.cid, selector, listener);
},
// Clears all callbacks previously bound to the view by `delegateEvents`.
// You usually don't need to use this, but may wish to if you have multiple
// BI views attached to the same DOM element.
undelegateEvents: function() {
if (this.$vessel) this.$vessel.off('.delegateEvents' + this.cid);
if (this.$vessel) this.$vessel.element.off('.delegateEvents' + this.cid);
return this;
},
// A finer-grained `undelegateEvents` for removing a single delegated event.
// `selector` and `listener` are both optional.
undelegate: function(eventName, selector, listener) {
this.$vessel.off(eventName + '.delegateEvents' + this.cid, selector, listener);
this.$vessel.element.off(eventName + '.delegateEvents' + this.cid, selector, listener);
},
// Produces a DOM element to be assigned to your view. Exposed for

17
src/core/view.js

@ -130,7 +130,7 @@ BI.View = BI.inherit(BI.V, {
});
var vessel = BI.createWidget();
this._cardLayouts[this.getName()].addCardByName(this.getName(), vessel);
return vessel.element;
return vessel;
},
_render: function (vessel) {
@ -501,15 +501,26 @@ BI.View = BI.inherit(BI.V, {
},
_unMount: function () {
BI.each(this._cardLayouts, function (name, card) {
card && card._unMount();
});
delete this._cardLayouts;
delete this._cards;
this.off();
this.destroyed();
},
destroy: function () {
BI.each(this._cardLayouts, function (name, card) {
card && card.destroy();
card && card._unMount();
});
delete this._cardLayouts;
delete this._cards;
this.destroyed();
this.remove();
this.trigger(BI.Events.DESTROY);
this.destroyed();
this.off();
},
destroyed: function () {

Loading…
Cancel
Save