赞
踩
实现get
- var Axios = {
- get: function(url) {
- return new Promise((resolve, reject) => {
- var xhr = new XMLHttpRequest();
- xhr.open('GET', url, true);
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4 && xhr.status == 200) {
- resolve(xhr.responseText)
- }
- };
- xhr.send();
- })
- },
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。