perf[chore]: add mock.js to instead of easy-mock (#281)

This commit is contained in:
花裤衩
2019-02-20 13:16:24 +08:00
committed by GitHub
parent 01018ee1f9
commit 5d82985a76
7 changed files with 136 additions and 1 deletions

14
mock/utils.js Normal file
View File

@@ -0,0 +1,14 @@
export function param2Obj(url) {
const search = url.split('?')[1]
if (!search) {
return {}
}
return JSON.parse(
'{"' +
decodeURIComponent(search)
.replace(/"/g, '\\"')
.replace(/&/g, '","')
.replace(/=/g, '":"') +
'"}'
)
}