MCPcopy
hub / github.com/compodoc/compodoc / removeTab

Method removeTab

test/fixtures/todomvc-ng2/src/app/test.component.ts:220–237  ·  view source on GitHub ↗

* 销毁指定的Tab页. 从0开始计数. * @param index

(index)

Source from the content-addressed store, hash-verified

218 * @param index
219 */
220 public removeTab(index) {
221 if (this._$tabPanes.length - index < 1) {
222 console.info('没有对应tab-pane 供删除');
223 return;
224 }
225
226 let tabTemp = this._$tabPanes.toArray();
227 tabTemp.splice(index, 1); // 去掉要删除的元素;
228
229 // 重新修改queryList. 不确定这么做有没有什么隐患.
230 this._$tabPanes.reset(tabTemp);
231 this.length = this._$tabPanes.length;
232 if (this.selectedIndex == index) {
233 this._handleSelect();
234 } else {
235 this.selectedIndex = this.selectedIndex - 1;
236 }
237 }
238
239 /**
240 * 当 没有指定选择哪个tab时自动处理选中的函数:

Callers

nothing calls this directly

Calls 3

_handleSelectMethod · 0.95
resetMethod · 0.65
infoMethod · 0.45

Tested by

no test coverage detected