<!-- 开发环境版本,包含了有帮助的命令行警告 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!-- axios在线地址 -->
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<input type="button" value="get请求" class="get">
<input type="button" value="post请求" class="post">
<!--
http://wthrcdn.etouch.cn/weather_mini
-->
<script>
方法:
document.querySelector(".get").onclick = function () {
axios.get("https://autumnfish.cn/api/joke/list?num=3")
.then(function(response){
console.log(response);
},function(err){
console.log(err);
})
}
document.querySelector(".post").onclick =function(){
axios.post("http://autumnfish.cn/api/user/reg",{username:"烟头西兰花"})
.then(function(response){
console.log(response);
})
}