✨ Custom methods support (follow up of #398)
This commit is contained in:
@@ -587,6 +587,14 @@ pre {
|
|||||||
.select-wrapper {
|
.select-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
input {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trigger {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
109
pages/index.vue
109
pages/index.vue
@@ -45,17 +45,92 @@
|
|||||||
<li>
|
<li>
|
||||||
<label for="method">{{ $t("method") }}</label>
|
<label for="method">{{ $t("method") }}</label>
|
||||||
<span class="select-wrapper">
|
<span class="select-wrapper">
|
||||||
<select id="method" v-model="method" @change="methodChange">
|
<v-popover>
|
||||||
<option value="GET">GET</option>
|
<input id="method" v-model="method" />
|
||||||
<option value="HEAD">HEAD</option>
|
<template slot="popover">
|
||||||
<option value="POST">POST</option>
|
<div>
|
||||||
<option value="PUT">PUT</option>
|
<button
|
||||||
<option value="DELETE">DELETE</option>
|
class="icon"
|
||||||
<option value="CONNECT">CONNECT</option>
|
@click="method = 'GET'"
|
||||||
<option value="OPTIONS">OPTIONS</option>
|
v-close-popover
|
||||||
<option value="TRACE">TRACE</option>
|
>
|
||||||
<option value="PATCH">PATCH</option>
|
GET
|
||||||
</select>
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="icon"
|
||||||
|
@click="method = 'HEAD'"
|
||||||
|
v-close-popover
|
||||||
|
>
|
||||||
|
HEAD
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="icon"
|
||||||
|
@click="method = 'POST'"
|
||||||
|
v-close-popover
|
||||||
|
>
|
||||||
|
POST
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="icon"
|
||||||
|
@click="method = 'PUT'"
|
||||||
|
v-close-popover
|
||||||
|
>
|
||||||
|
PUT
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="icon"
|
||||||
|
@click="method = 'DELETE'"
|
||||||
|
v-close-popover
|
||||||
|
>
|
||||||
|
DELETE
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="icon"
|
||||||
|
@click="method = 'CONNECT'"
|
||||||
|
v-close-popover
|
||||||
|
>
|
||||||
|
CONNECT
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="icon"
|
||||||
|
@click="method = 'OPTIONS'"
|
||||||
|
v-close-popover
|
||||||
|
>
|
||||||
|
OPTIONS
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="icon"
|
||||||
|
@click="method = 'TRACE'"
|
||||||
|
v-close-popover
|
||||||
|
>
|
||||||
|
TRACE
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
class="icon"
|
||||||
|
@click="method = 'PATCH'"
|
||||||
|
v-close-popover
|
||||||
|
>
|
||||||
|
PATCH
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</v-popover>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -1574,6 +1649,12 @@ export default {
|
|||||||
editingRequest(newValue) {
|
editingRequest(newValue) {
|
||||||
this.editRequest = newValue;
|
this.editRequest = newValue;
|
||||||
this.showRequestModal = true;
|
this.showRequestModal = true;
|
||||||
|
},
|
||||||
|
method() {
|
||||||
|
// this.$store.commit('setState', { 'value': ["POST", "PUT", "PATCH"].includes(this.method) ? 'application/json' : '', 'attribute': 'contentType' })
|
||||||
|
this.contentType = ["POST", "PUT", "PATCH"].includes(this.method)
|
||||||
|
? "application/json"
|
||||||
|
: "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -2669,12 +2750,6 @@ export default {
|
|||||||
}
|
}
|
||||||
this.setRouteQueryState();
|
this.setRouteQueryState();
|
||||||
},
|
},
|
||||||
methodChange() {
|
|
||||||
// this.$store.commit('setState', { 'value': ["POST", "PUT", "PATCH"].includes(this.method) ? 'application/json' : '', 'attribute': 'contentType' })
|
|
||||||
this.contentType = ["POST", "PUT", "PATCH"].includes(this.method)
|
|
||||||
? "application/json"
|
|
||||||
: "";
|
|
||||||
},
|
|
||||||
uploadPayload() {
|
uploadPayload() {
|
||||||
this.rawInput = true;
|
this.rawInput = true;
|
||||||
const file = this.$refs.payload.files[0];
|
const file = this.$refs.payload.files[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user