* 销毁指定的Tab页. 从0开始计数. * @param index
(index)
| 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时自动处理选中的函数: |
nothing calls this directly
no test coverage detected