Browse Source

Pull request #2871: 无JIRA tab的showIndex 响应式也支持false的时候不进行创建

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

* commit 'b0ae7a53b548f8d01a0d6f81b1a239b97df61d2d':
  无jira 类型
  无JIRA tab的showIndex 响应式也支持false的时候不进行创建
es6
Dailer 2 years ago
parent
commit
fe411b5b85
  1. 23
      src/base/combination/tab.js
  2. 15
      typescript/core/widget.ts

23
src/base/combination/tab.js

@ -86,15 +86,18 @@ BI.Tab = BI.inherit(BI.Widget, {
created: function () { created: function () {
var self = this, o = this.options; var self = this, o = this.options;
if (o.showIndex !== false) {
if (BI.isFunction(o.showIndex)) { var showIndex;
var v = this.__watch(o.showIndex, function (context, newValue) { if (BI.isFunction(o.showIndex)) {
self.setSelect(newValue); showIndex = this.__watch(o.showIndex, function (context, newValue) {
}); self.setSelect(newValue);
this.setSelect(v); });
} else { } else {
this.setSelect(o.showIndex); showIndex = o.showIndex;
} }
if (showIndex !== false) {
this.setSelect(showIndex);
} }
}, },
@ -135,7 +138,7 @@ BI.Tab = BI.inherit(BI.Widget, {
getTab: function (v) { getTab: function (v) {
this._assertCard(v); this._assertCard(v);
return this.layout.getCardByName(v); return this.layout.getCardByName(v);
}, },
setValue: function (v) { setValue: function (v) {

15
typescript/core/widget.ts

@ -42,8 +42,8 @@ export interface _Widget extends _OB {
element: { element: {
width(): number; width(): number;
height(): number; height(): number;
width(width: number | string): _Widget['element']; width(width: number | string): _Widget["element"];
height(height: number | string): _Widget['element']; height(height: number | string): _Widget["element"];
[key: string]: any; [key: string]: any;
}; };
@ -110,7 +110,7 @@ export interface _Widget extends _OB {
/** /**
* *
*/ */
shouldUpdate?(): void; shouldUpdate?(...args: any[]): void;
/** /**
* *
@ -449,8 +449,8 @@ export declare class Widget extends OB {
element: { element: {
width(): number; width(): number;
height(): number; height(): number;
width(width: number | string): Widget['element']; width(width: number | string): Widget["element"];
height(height: number | string): Widget['element']; height(height: number | string): Widget["element"];
[key: string]: any; [key: string]: any;
}; };
@ -783,6 +783,11 @@ export declare class Widget extends OB {
*/ */
_unMount(): void; _unMount(): void;
/**
* watch响应式数据
*/
__watch<T extends (...args: any) => any>(getter: T, handler: Function, options?: Obj): ReturnType<T>
/** /**
* hang元素 * hang元素
*/ */

Loading…
Cancel
Save