prevent JSON.parse fault when search is undefined

pull/111/head
卜木 8 years ago committed by 花裤衩
parent ffd668fb7d
commit 56a048865d

@ -110,7 +110,11 @@
export function param2Obj(url) {
const search = url.split('?')[1];
return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}')
if (search !== undefined) {
return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');
}
return {};
}
export function html2Text(val) {

Loading…
Cancel
Save