1 Star 1 Fork 0

sundaysmile / Vue.js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
axios基本使用.html 1.09 KB
一键复制 编辑 原始数据 按行查看 历史
Heretic324 提交于 2020-06-08 21:24 . Add files via upload
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>axios基本使用</title>
</head>
<body>
<input type="button" value="get请求" class="get">
<input type="button" value="post请求" class="post">
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
document.querySelector(".get").onclick = function () {
axios.get("https://autumnfish.cn/api/joke/list?num=6")
.then(function(response) {
console.log(response);
},function(err){
console.log(err);
})
}
document.querySelector(".post").onclick = function () {
axios.post("https://autumnfish.cn/api/user/reg",{username:"盐焗西兰花"})
.then(function(response){
console.log(response);
console.log(this.skill);
},function (err) {
console.log(err);
})
}
</script>
</body>
</html>
JavaScript
1
https://gitee.com/lzp507/Vue.js.git
git@gitee.com:lzp507/Vue.js.git
lzp507
Vue.js
Vue.js
master

搜索帮助