修复误删变量定义
parent
48301ee0ec
commit
0735b4452d
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@bytedo/fetch",
|
"name": "@bytedo/fetch",
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"description": "全新的ajax封装。分2个版本, 一个基于XMLHttpRequest, 一个基于window.fetch",
|
"description": "全新的ajax封装。分2个版本, 一个基于XMLHttpRequest, 一个基于window.fetch",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
|
13
src/index.js
13
src/index.js
|
@ -150,18 +150,19 @@ class _Request {
|
||||||
|
|
||||||
/* -------------------------- 3»» 处理跨域 --------------------- */
|
/* -------------------------- 3»» 处理跨域 --------------------- */
|
||||||
try {
|
try {
|
||||||
|
let crossDomain
|
||||||
let $a = document.createElement('a')
|
let $a = document.createElement('a')
|
||||||
$a.href = options.url
|
|
||||||
|
|
||||||
|
$a.href = options.url
|
||||||
crossDomain = location.protocol !== $a.protocol || location.host !== $a.host
|
crossDomain = location.protocol !== $a.protocol || location.host !== $a.host
|
||||||
$a = null
|
$a = null
|
||||||
} catch (err) {}
|
|
||||||
|
|
||||||
if (crossDomain) {
|
if (crossDomain) {
|
||||||
if (options.credentials) {
|
if (options.credentials) {
|
||||||
this.xhr.withCredentials = true
|
this.xhr.withCredentials = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (err) {}
|
||||||
|
|
||||||
/* ------------- 4»» 根据method类型, 处理表单数据 ---------------- */
|
/* ------------- 4»» 根据method类型, 处理表单数据 ---------------- */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue