From 4fa07aea09ca859421765d69705a69173ad358e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E6=9C=A8?= Date: Mon, 3 Jul 2017 11:21:31 +0800 Subject: [PATCH] Update index.js --- src/utils/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index aa449c8d..5cf482dc 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -110,11 +110,10 @@ export function param2Obj(url) { const search = url.split('?')[1]; - if (search !== undefined) { - return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}'); + if (!search) { + return {} } - return {}; - + return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}'); } export function html2Text(val) {