chenlong 3 months ago
parent
commit
f4ce5f812a
  1. 7
      Admin/View/Document/view_api_info.php

7
Admin/View/Document/view_api_info.php

@ -65,7 +65,7 @@ $apiInfo = El::double('el-card')->setAttr('v-if', 'currentApiInfo')->append(
El::double('iframe')->setAttr("src", TP::route()->to([DocumentController::class, 'requestCode'])),
),
El::double('el-tab-pane')->setAttr('label', '响应')->setAttr('name', 'Response')->append(
El::fromCode('<div id="ResponseJson" v-if="typeof response === \'object\'" style="width: 100%; height: calc(100vh - 250px);"></div>'),
El::fromCode('<div id="ResponseJson" v-if="typeof response !== \'string\'" style="width: 100%; height: calc(100vh - 250px);"></div>'),
El::fromCode('<div v-else v-html="response" style="width: 100%; height: calc(100vh - 250px);"></div>'),
),
)
@ -90,7 +90,7 @@ $vue->addMethod('apiShowType', JsFunc::anonymous(['name'])->code(
}))"),
),
JsIf::when("name === 'Response' && this.responseEditor === null")->then(
JsCode::raw("this.responseEditor = new JSONEditor(document.getElementById('ResponseJson'), this.jsonEditorInitOptions('code', (value) => {}))"),
JsCode::raw("this.\$nextTick(() => this.responseEditor = new JSONEditor(document.getElementById('ResponseJson'), this.jsonEditorInitOptions('code', (value) => {})))"),
),
JsCode::raw('this.$nextTick(() => {
this.apiFormEditor && this.apiFormEditor.set(this.apiFormData);
@ -131,7 +131,8 @@ $vue->addMethod('sendRequest', JsFunc::anonymous()->code(
}
}
};
this.showApiInfo = "Response";
this.showApiInfo = "Response";
this.apiShowType(this.showApiInfo);
request.call(this.currentApiInfo.url, this.currentApiInfo.method, this.apiFormData);
JS)
));

Loading…
Cancel
Save