fix default body type.
This commit is contained in:
@@ -295,6 +295,7 @@ try {
|
||||
structType: {
|
||||
handler(val) {
|
||||
this.changeType()
|
||||
this.$emit('change-type', this.structType)
|
||||
}
|
||||
},
|
||||
current: {
|
||||
@@ -312,7 +313,6 @@ try {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log(this.showType, this.structType)
|
||||
this.current = [this.getInitField()]
|
||||
if (this.attr && this.attr.length > 0) {
|
||||
const attr = [];
|
||||
|
||||
@@ -7,6 +7,7 @@ var app = new Vue({
|
||||
params: "",
|
||||
response: "",
|
||||
defaultHeader: {field: '', required: '', desc: ''},
|
||||
attrType: '',
|
||||
},
|
||||
created() {
|
||||
this.header.push({...this.defaultHeader});
|
||||
@@ -30,12 +31,21 @@ var app = new Vue({
|
||||
this.setParams();
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
attrType: {
|
||||
handler() {
|
||||
this.setParams()
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeAttr(val) {
|
||||
this.body = val;
|
||||
},
|
||||
changeType(val) {
|
||||
this.attrType = val
|
||||
},
|
||||
changeRes(val) {
|
||||
val = this.filterParams(val)
|
||||
this.response = JSON.stringify(val);
|
||||
@@ -47,6 +57,7 @@ var app = new Vue({
|
||||
const params = {
|
||||
header: header,
|
||||
params: body,
|
||||
paramsType: this.attrType,
|
||||
query: queryP,
|
||||
}
|
||||
this.params = JSON.stringify(params);
|
||||
|
||||
@@ -16,6 +16,7 @@ var app = new Vue({
|
||||
params: "",
|
||||
defaultHeader: {field: '', required: '', desc: ''},
|
||||
attr: [],
|
||||
attrType: 'formData',
|
||||
api
|
||||
},
|
||||
created() {
|
||||
@@ -25,6 +26,7 @@ var app = new Vue({
|
||||
if(api.params.header && api.params.header.length > 0) this.header = api.params.header
|
||||
if(api.params.query && api.params.query.length > 0) this.queryP = api.params.query
|
||||
if(api.params.params && api.params.params.length > 0) this.attr = api.params.params
|
||||
if(api.params.paramsType) this.attrType = api.params.paramsType
|
||||
this.setParams();
|
||||
}
|
||||
},
|
||||
@@ -46,12 +48,21 @@ var app = new Vue({
|
||||
this.setParams()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
attrType: {
|
||||
handler() {
|
||||
this.setParams()
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeAttr(val) {
|
||||
this.body = val
|
||||
},
|
||||
changeType(val) {
|
||||
this.attrType = val
|
||||
},
|
||||
changeRes(val) {
|
||||
val = this.filterParams(val)
|
||||
this.response = JSON.stringify(val)
|
||||
@@ -63,6 +74,7 @@ var app = new Vue({
|
||||
const params = {
|
||||
header: header,
|
||||
params: body,
|
||||
paramsType: this.attrType,
|
||||
query: queryP,
|
||||
}
|
||||
this.params = JSON.stringify(params);
|
||||
|
||||
@@ -186,7 +186,7 @@ js::set('struct_paramsType', $lang->struct->paramsType);
|
||||
<tr>
|
||||
<th><?php echo $lang->api->params;?></th>
|
||||
<td colspan='2'>
|
||||
<body-field @change="changeAttr"></body-field>
|
||||
<body-field @change="changeAttr" @change-type="changeType"></body-field>
|
||||
<input type="hidden" name="params" v-model="params">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -187,7 +187,7 @@ js::set('api', $api);
|
||||
<tr>
|
||||
<th><?php echo $lang->api->params;?></th>
|
||||
<td colspan='2'>
|
||||
<body-field @change="changeAttr" :attr="attr"></body-field>
|
||||
<body-field @change="changeAttr" :attr="attr" :struct-type="attrType" @change-type="changeType"></body-field>
|
||||
<input type="hidden" name="params" v-model="params">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -48,7 +48,7 @@ js::set('struct', $struct);
|
||||
<tr>
|
||||
<td class="w-110px"></td>
|
||||
<td colspan="2">
|
||||
<body-field @change="changeAttr" :attr="struct.attribute"></body-field>
|
||||
<body-field @change="changeAttr" :attr="struct.attribute" :struct-type="struct.type"></body-field>
|
||||
<input type="hidden" name="attribute" v-model="attr">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user