rewrite axios && mock data

This commit is contained in:
Pan
2017-05-15 17:56:45 +08:00
parent 1d05d661bc
commit 5aa22731c8
17 changed files with 137 additions and 204 deletions

View File

@@ -110,6 +110,11 @@
})).join('&');
}
export function param2Obj(url) {
const search = url.split('?')[1];
return JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}')
}
export function html2Text(val) {
const div = document.createElement('div');
div.innerHTML = val;