当前位置:网站首页>get请求和post请求区别
get请求和post请求区别
2022-07-19 06:26:00 【这次我一定要赢】
通过mockfast来模拟get和post来介绍下两者的区别
请求参数的位置POST
<template>
<div class="" />
</template>
<script>
import axios from 'axios'
export default {
name: '',
created() {
this.login()
},
methods: {
login() {
axios({
url: 'https://www.fastmock.site/mock/f9834bca1c0604895ec164037a0590c6/api/api',
method: 'post',
data: '123'
}).then(res => {
console.log(res)
})
}
}
}
</script>
<style scoped>
</style>
POST参数在data填写。
POST参数在请求体里面
相比于GET在地址栏更加安全
请求参数的位置GET
<template>
<div class="" />
</template>
<script>
import axios from 'axios'
export default {
name: '',
created() {
this.login()
},
methods: {
login() {
axios({
url: 'https://www.fastmock.site/mock/f9834bca1c0604895ec164037a0590c6/api/test',
data: 123
}).then(res => {
console.log(res)
})
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="" />
</template>
<script>
import axios from 'axios'
export default {
name: '',
created() {
this.login()
},
methods: {
login() {
axios({
url: 'https://www.fastmock.site/mock/f9834bca1c0604895ec164037a0590c6/api/test',
params: 123
}).then(res => {
console.log(res)
})
}
}
}
</script>
<style scoped>
</style>
Get用params传递参数,拼接在URL参数。
边栏推荐
猜你喜欢
Chain storage structure of binary tree
Factors affecting the quality of slip rings in production
[yunyuansheng boy rushes into the Ninth Heaven of IVX platform] 1: project creation of actual ivx-0 code programming experience
Dynamically adjust impala log level
Cake cutting problem [Olympiad Mathematics in grade two of primary school]
练手版通讯录
错误的locale设置导致Impala crash
優化yum源之優化base庫
wet-英语困难户的好选择-控制台翻译
【向量空间】
随机推荐
Datetimepicker sets the default time range, beyond which it is not optional
ROS turtle following (coordinate transformation)
3. Editors (vim)
数据库基础知识
unity性能优化方向
Apache impala 4.0 overview
ikbc键盘win键失效的解决方法
MySQL手动注入步骤
Bases de données
在CDH6.3中单独升级Impala到Apache Impala 3.4
[solve ax=0]
js优化双层for循环的方法
16day
Apache Impala 4.0概览
【求解AX=0】
导电滑环的运行温度
导电滑环的内部结构和使用范围
JDBC connection MySQL loading class `com mysql. jdbc. Driver‘. This is deprecated
JDBC连接MySQL Loading class `com.mysql.jdbc.Driver‘. This is deprecated
JS operation properties, styles and events