Browse Source

Pull request #2551: 无JRIA tab在single:true状态下支持keepAlive

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit 'bc81cb3714ec77681bb49fdef53fd9ad83724006':
  无JRIA tab在single:true状态下支持keepAlive
  无JRIA tab在single:true状态下支持keepAlive
  无JRIA tab在single:true状态下支持keepAlive
es6
Dailer 3 years ago
parent
commit
cedfca1fb1
  1. 11
      src/base/combination/tab.js
  2. 3
      src/router/router.js
  3. 1
      typescript/base/combination/tab.ts

11
src/base/combination/tab.js

@ -15,7 +15,8 @@ BI.Tab = BI.inherit(BI.Widget, {
tab: false,
cardCreator: function (v) {
return BI.createWidget();
}
},
keepAlives: []
});
},
@ -66,7 +67,7 @@ BI.Tab = BI.inherit(BI.Widget, {
var self = this, o = this.options;
if (o.single === true) {
BI.each(this.cardMap, function (name, card) {
if (name !== (currCardName + "")) {
if (name !== (currCardName + "") && self._keepAlive(name) !== true) {
self.layout.deleteCardByName(name);
delete self.cardMap[name];
}
@ -82,6 +83,12 @@ BI.Tab = BI.inherit(BI.Widget, {
}
},
_keepAlive: function (v) {
var o = this.options;
return BI.isFunction(o.keepAlives) ? o.keepAlives(v) : BI.contains(o.keepAlives, v);
},
created: function () {
var o = this.options;
if (o.showIndex !== false) {

3
src/router/router.js

@ -3179,7 +3179,8 @@
ref: function (_ref) {
self.tab = _ref;
},
single: false, // 是不是单页面
single: o.single, // 是不是单页面
keepAlives: o.keepAlives,
logic: {
dynamic: false
},

1
typescript/base/combination/tab.ts

@ -15,6 +15,7 @@ export declare class Tab extends Widget {
dynamic: boolean;
};
tab?: Obj;
keepAlives?: string[] | ((cardName: string) => boolean)
}
setSelect(v: string | number, action?: Action, callback?: Function): void;

Loading…
Cancel
Save