fix: new websocket tab jump to mock

This commit is contained in:
scarqin 2022-10-02 13:18:40 +08:00
parent 860ffce8f9
commit 174b38f9b8
2 changed files with 3 additions and 4 deletions

View File

@ -87,9 +87,8 @@ export class ApiTabOperateService {
* *
* @returns tabItem * @returns tabItem
*/ */
newDefaultTab(key = 'http-test') { newDefaultTab(path?) {
const pathHash = ['http-test', 'http-edit', 'http-detail', 'overview', 'ws-test', 'http-mock']; const tabItem = Object.assign({}, eoDeepCopy(this.BASIC_TABS.find(val=>val.pathname===path)||this.BASIC_TABS[0]));
const tabItem = Object.assign({}, eoDeepCopy(this.BASIC_TABS[pathHash.findIndex((it) => it === key)]));
tabItem.params = {}; tabItem.params = {};
tabItem.uuid = tabItem.params.pageID = Date.now(); tabItem.uuid = tabItem.params.pageID = Date.now();
Object.assign(tabItem, { isLoading: false }); Object.assign(tabItem, { isLoading: false });

View File

@ -56,7 +56,7 @@
<nz-dropdown-menu #addMenu="nzDropdownMenu"> <nz-dropdown-menu #addMenu="nzDropdownMenu">
<ul nz-menu> <ul nz-menu>
<li nz-menu-item (click)="newTab()">HTTP</li> <li nz-menu-item (click)="newTab()">HTTP</li>
<li nz-menu-item (click)="newTab('ws-test')">Websocket</li> <li nz-menu-item (click)="newTab('/home/api/ws/test')">Websocket</li>
</ul> </ul>
</nz-dropdown-menu> </nz-dropdown-menu>
<a nz-dropdown [nzDropdownMenu]="menu"> <a nz-dropdown [nzDropdownMenu]="menu">