Commit d5cc95fefbb7dea269602b8b20d67c368d905369
1 parent
d29fe10b
升级element-ui版本到2.13.2
Showing
2 changed files
with
13 additions
and
11 deletions
ruoyi-ui/package.json
ruoyi-ui/src/utils/index.js
| ... | ... | @@ -124,19 +124,21 @@ export function param(json) { |
| 124 | 124 | * @returns {Object} |
| 125 | 125 | */ |
| 126 | 126 | export function param2Obj(url) { |
| 127 | - const search = url.split('?')[1] | |
| 127 | + const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') | |
| 128 | 128 | if (!search) { |
| 129 | 129 | return {} |
| 130 | 130 | } |
| 131 | - return JSON.parse( | |
| 132 | - '{"' + | |
| 133 | - decodeURIComponent(search) | |
| 134 | - .replace(/"/g, '\\"') | |
| 135 | - .replace(/&/g, '","') | |
| 136 | - .replace(/=/g, '":"') | |
| 137 | - .replace(/\+/g, ' ') + | |
| 138 | - '"}' | |
| 139 | - ) | |
| 131 | + const obj = {} | |
| 132 | + const searchArr = search.split('&') | |
| 133 | + searchArr.forEach(v => { | |
| 134 | + const index = v.indexOf('=') | |
| 135 | + if (index !== -1) { | |
| 136 | + const name = v.substring(0, index) | |
| 137 | + const val = v.substring(index + 1, v.length) | |
| 138 | + obj[name] = val | |
| 139 | + } | |
| 140 | + }) | |
| 141 | + return obj | |
| 140 | 142 | } |
| 141 | 143 | |
| 142 | 144 | /** | ... | ... |