Skip to content

Commit 4fa07ae

Browse files
xqbumuPanJiaChen
authored andcommitted
Update index.js
1 parent 56a0488 commit 4fa07ae

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/utils/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,10 @@
110110

111111
export function param2Obj(url) {
112112
const search = url.split('?')[1];
113-
if (search !== undefined) {
114-
return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');
113+
if (!search) {
114+
return {}
115115
}
116-
return {};
117-
116+
return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');
118117
}
119118

120119
export function html2Text(val) {

0 commit comments

Comments
 (0)