From 775e5d6f6693f7c6d632897d50b583ce972b28e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Thu, 28 Jun 2018 22:31:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Drequest.jsonp=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8D=E5=8F=91=E9=80=81=E7=9A=84bug;=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Drouter=E7=BB=84=E4=BB=B6=E5=88=B7=E6=96=B0=E6=97=B6URL?= =?UTF-8?q?=E7=9A=84search=E9=83=A8=E5=88=86=E4=B8=A2=E5=A4=B1=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/request/index.js | 2 +- src/js/router/index.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/request/index.js b/src/js/request/index.js index 0ab712a..d841be8 100644 --- a/src/js/request/index.js +++ b/src/js/request/index.js @@ -33,7 +33,7 @@ try { let originAnchor = doc.createElement('a') originAnchor.href = location.href -const noBodyMethods = ['GET', 'HEAD'] +const noBodyMethods = ['GET', 'HEAD', 'JSONP'] const error = { 10001: 'argument url is required', 10002: 'method "set" required an object or 2 args', diff --git a/src/js/router/index.js b/src/js/router/index.js index 687f91b..e781429 100644 --- a/src/js/router/index.js +++ b/src/js/router/index.js @@ -202,8 +202,9 @@ class Router { this.path = path } else { let hash = forceCleanHash ? '' : location.hash + let search = forceCleanHash ? '' : location.search path = path.replace(/^[/]+?/, '') - window.history.pushState({ path }, null, `/${path + hash}`) + window.history.pushState({ path }, null, `/${path + search + hash}`) this.path = path // pushState不会触发popstate事件,所以要手动触发路由检测 this.__check__()