完整的ajax封装
function ajax (options) {
// 默认值
var defaults = {
type: 'get',
url: '',
data: {},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function () {},
error: function () {}
}
// 使用用户传递的参数替换默认值参数
Object.assign(defa
原创
2021-09-12 16:44:55 ·
106 阅读 ·
0 评论