优化反复请求时,清除上次的结果,显示初始值

dev
RogerWork 3 months ago
parent d16ea26dea
commit a928823497
  1. 8
      src/components/ec_api/TabArea.vue

@ -196,6 +196,12 @@ function handle_request_url() {
// api
function send_request() {
if (UserApiData.value.api[activeTab.value].format === 'json'){
UserApiData.value.api[activeTab.value].response = '{"root": "root"}'
}
if (UserApiData.value.api[activeTab.value].format === 'html' || UserApiData.value.api[activeTab.value].format === 'xml'){
UserApiData.value.api[activeTab.value].response = '<root></root>'
}
const data = handle_request_data()
ec_api_send_request(data).then(res => {
if (res.format === 'json') {
@ -351,7 +357,7 @@ const ace_options = {
</el-col>
</el-row>
<v-ace-editor v-model:value="UserApiData.api[api['id']].response" :lang="UserApiData.api[api['id']]['format']"
theme="chrome" :options="ace_options" class="vue-ace-editor" style="width: 1200px"/>
theme="chrome" :options="ace_options" class="vue-ace-editor" :wrap="true" style="width: 1200px"/>
</el-tab-pane>
</el-tabs>
</template>

Loading…
Cancel
Save