Skip to content

Commit

Permalink
feat: persistence dyWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Aug 2, 2022
1 parent 96dfe4c commit 9e37e85
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/workbench/browser/src/app/pages/api/api.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { StorageService } from '../../shared/services/storage';
import { Change } from '../../shared/store/env.state';
import { RemoteService } from 'eo/workbench/browser/src/app/shared/services/remote/remote.service';

const DY_WIDTH_KEY = 'DY_WIDTH';

@Component({
selector: 'eo-api',
templateUrl: './api.component.html',
Expand Down Expand Up @@ -39,7 +41,7 @@ export class ApiComponent implements OnInit, OnDestroy {
envInfo: any = {};
envList: Array<any> = [];
activeUuid: number | string = 0;
dyWidth = 250;
dyWidth = localStorage.getItem(DY_WIDTH_KEY) ? Number(localStorage.getItem(DY_WIDTH_KEY)) : 250;
tabsIndex = 0;
private destroy$: Subject<void> = new Subject<void>();

Expand Down Expand Up @@ -101,6 +103,7 @@ export class ApiComponent implements OnInit, OnDestroy {
}
}
});
console.log('dyWidth', this.dyWidth);
}
ngOnDestroy() {
this.destroy$.next();
Expand Down Expand Up @@ -194,5 +197,6 @@ export class ApiComponent implements OnInit, OnDestroy {
handleDrag(e) {
const distance = e;
this.dyWidth = distance;
localStorage.setItem(DY_WIDTH_KEY, String(this.dyWidth));
}
}

0 comments on commit 9e37e85

Please sign in to comment.