标签:you amp ofo .com 地址 www param exp payload
一、简介二、使用
1、在需要的模块中引入使用:
import axios from ‘axios‘
2、语法:
三、案例
<template>
<div class="hello">
<h1>{{ msg }}</h1>
</div>
</template>
<script>
import axios from ‘axios‘
export default {
name: ‘HelloWorld‘,
data () {
return {
msg: ‘Welcome to Your Vue.js App‘
}
},
created(){
/*axios.get(‘https://www.easy-mock.com/mock/5c1767c06ccaa7461ef01ee9/example/dataList‘,{
params:{
name:‘xiao‘,
age:‘20‘
}
})
.then((response)=>{
console.log(response.data)
})
.catch((error)=>{
console.log(error)
})*/
//发送给后端的数据附在url的?后面
//Request URL:https://www.easy-mock.com/mock/5c1767c06ccaa7461ef01ee9/example/dataList?name=xiao
axios.post(‘https://www.easy-mock.com/mock/5c1767c06ccaa7461ef01ee9/example/postData‘,{
name:‘xiao‘
})
.then((response)=>{
console.log(response.data)
})
.catch((error)=>{
console.log(error)
})
}
}
////数据是隐藏的,不会显示出来,放在Request Payload {name:‘xiao‘}
</script>
标签:you amp ofo .com 地址 www param exp payload
原文地址:http://blog.51cto.com/9161018/2331694