Add request method

This commit is contained in:
landaiqing 2023-07-24 14:06:51 +08:00
parent 943b4c0b87
commit 2eb0ac21d6

View File

@ -6,27 +6,34 @@
<!-- <span style="font-size: 30px;font-weight: bold">Simple Json View</span>--> <!-- <span style="font-size: 30px;font-weight: bold">Simple Json View</span>-->
<div style="display: flex;flex-direction: row;align-items: flex-end;height: 30px"> <div style="display: flex;flex-direction: row;align-items: flex-end;height: 30px">
<el-link :underline="false" href="https://landaiqing.space" target='_blank' style="font-size: medium">博客</el-link> <el-link :underline="false" href="https://landaiqing.space" target='_blank' style="font-size: medium">博客</el-link>
<el-link :underline="false" href="https://landaiqing.space" target='_blank' style="font-size: medium;margin-left: 20px">源码</el-link> <el-link :underline="false" href="https://git.landaiqing.space/Qing/simple-json-view" target='_blank' style="font-size: medium;margin-left: 20px">源码</el-link>
</div> </div>
</el-header> </el-header>
<el-main style="width: 100%"> <el-main style="width: 100%">
<div style="display: flex;flex-direction: row;align-items: center"> <div style="display: flex;flex-direction: row;align-items: center;justify-content: center">
<el-input <el-input
autosize autosize
type="text" type="text"
placeholder="输入接口链接或在下方输入Json" placeholder="输入接口链接或在下方输入Json"
style="width: 100%;margin-bottom: 10px;margin-top: 30px" style=";margin-bottom: 10px;margin-top: 30px"
@blur="getJson" @blur="getJson"
v-model="url" v-model="url"
> >
</el-input> </el-input>
<div style="display: flex;flex-direction: row;flex-wrap: nowrap;align-items: center">
<el-radio-group @change="radioChange($event)" v-model="radio" style="margin-top: 15px;width: 150px;height: 30px;display: flex;flex-direction: row;align-items: center">
<el-radio :label="1">get</el-radio>
<el-radio :label="2">post</el-radio>
</el-radio-group>
</div>
</div> </div>
<JsonEditor :json-data="jsonData"></JsonEditor> <JsonEditor :json-data="jsonData"></JsonEditor>
<!-- <JsonSchema></JsonSchema>--> <!-- <JsonSchema></JsonSchema>-->
</el-main> </el-main>
<el-footer style="height: 20px"> <el-footer style="height: 20px">
陕ICP备2023001488号 | 陕公网安备 61072902000127 Qing | 陕ICP备2023001488号 | 陕公网安备 61072902000127
</el-footer> </el-footer>
</el-container> </el-container>
</div> </div>
@ -48,15 +55,16 @@ export default {
return{ return{
url:null, url:null,
jsonData:null, jsonData:null,
radio:2,
} }
}, },
methods:{ methods:{
getJson(){ getJson(){
console.log(this.url); console.log(this.radio)
if(this.url!==null){ if(this.url!==null){
var that=this; var that=this;
axios({ axios({
method: 'post', method: this.radio===2?'post':'get',
// //
url: this.url, url: this.url,
}).then( (res)=> { }).then( (res)=> {
@ -73,6 +81,9 @@ export default {
return false; return false;
} }
},
radioChange(){
this.getJson();
} }
} }
} }