修复误删变量定义

master
yutent 2022-11-02 18:33:36 +08:00
parent 48301ee0ec
commit 0735b4452d
2 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@bytedo/fetch",
"version": "2.1.0",
"version": "2.1.1",
"description": "全新的ajax封装。分2个版本, 一个基于XMLHttpRequest, 一个基于window.fetch",
"main": "dist/index.js",
"files": [

View File

@ -150,18 +150,19 @@ class _Request {
/* -------------------------- 3»» 处理跨域 --------------------- */
try {
let crossDomain
let $a = document.createElement('a')
$a.href = options.url
$a.href = options.url
crossDomain = location.protocol !== $a.protocol || location.host !== $a.host
$a = null
} catch (err) {}
if (crossDomain) {
if (options.credentials) {
this.xhr.withCredentials = true
if (crossDomain) {
if (options.credentials) {
this.xhr.withCredentials = true
}
}
}
} catch (err) {}
/* ------------- 4»» 根据method类型, 处理表单数据 ---------------- */