Skip to content

Commit

Permalink
fix(componets): [api-edit-body] import json root type
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed May 30, 2022
1 parent 546d059 commit 80a1fb5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
</nz-radio-group>
<nz-divider nzType="vertical"></nz-divider>
<params-import *ngIf="['formData', 'json', 'xml'].includes(bodyType)" [baseData]="model" [contentType]="bodyType"
(baseDataChange)="handleParamsImport($event)" [rootType]="jsonRootType"></params-import>
(baseDataChange)="handleParamsImport($event)" (beforeHandleImport)="beforeHandleImport($event)"
[rootType]="jsonRootType"></params-import>
</div>
<div *ngIf="bodyType === 'json'">
<p class="fs12 c999 mb5">JSON 根类型:</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ export class ApiTestBodyComponent implements OnInit, OnChanges, OnDestroy {
this.model = data;
this.modelChange.emit(data);
}

beforeHandleImport(result) {
this.jsonRootType = Array.isArray(result) ? 'array' : 'object';
}

rawDataChange() {
this.rawChange$.next(this.model);
}
Expand Down

0 comments on commit 80a1fb5

Please sign in to comment.