首页 > 移动平台 > 详细

vuebase--9._axios post请求

时间:2019-08-11 10:48:45      阅读:89      评论:0      收藏:0      [点我收藏+]

1.axios-post请求

 

<template lang="html">
<div class="hello">
HelloWorld!
</div>
</template>

<script>
import qs from "qs"; // 解决参数格式的转码问题 ?name=xxxxx&age=100 {name:ixxxxx,age:100}
export default {
name: ‘HelloWorld‘,
data() {
return {
msg: ‘Welcome to Your Vue.js App‘
}
},
mounted() {
/* this.$axios.get("xxxx")
.then(res => {
console.log(res.data)
}).catch(error => {
console.log(error);
}) */
this.$axios.post("xxx",qs.stringify({
uers_id:"12345",
password:"1234567890"
})).then(res =>{
console.log(res.data)
}).catch(error=>{
console.log(error)
})
}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1,
h2 {
font-weight: normal;
}

ul {
list-style-type: none;
padding: 0;
}

li {
display: inline-block;
margin: 0 10px;
}

a {
color: #42b983;
}
</style>

vuebase--9._axios post请求

原文:https://www.cnblogs.com/xiao-peng-ji/p/11333656.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!