(data, type, isEdit, result = '')
| 191 | } |
| 192 | |
| 193 | export function objectUrlEval (data, type, isEdit, result = '') { |
| 194 | // 此方法的用法: |
| 195 | // 若存在 此数据结构的数据 ps: a: { b: c: { d: { name: 'xx'}} } |
| 196 | // 调用此方法仅需 objectUrlEval(a, 'b.c.d.name',false) 即可返回 'xx' |
| 197 | // 若 objectUrlEval(a, 'b.c.d.name',true, 'yy') 可修改name的值为 'yy' |
| 198 | // 第一个参数是数据源 第二个参数是对象的路径 第三个若传则为此路径赋值 |
| 199 | if (data !== undefined) { |
| 200 | const temp = type.split('.'); |
| 201 | const tempLength = temp.length; // 路径的长度 |
| 202 | let tempA = data; |
| 203 | for (let i = 0; i < tempLength; i++) { |
| 204 | if (i === tempLength - 1) { |
| 205 | if (isEdit) { |
| 206 | tempA[temp[i]] = result // 赋值 |
| 207 | // 如果想要监听数组变化用set |
| 208 | // this.$set(tempA, temp[i], result); |
| 209 | break; |
| 210 | } else { |
| 211 | // if (typeof tempA[temp[i]] === 'object') { |
| 212 | // return JSON.stringify(tempA[temp[i]]) |
| 213 | // } |
| 214 | return tempA[temp[i]]; // 获取值返回 |
| 215 | } |
| 216 | } |
| 217 | if (typeof tempA[temp[i]] === 'object') { |
| 218 | tempA = tempA[temp[i]]; |
| 219 | continue; |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | export function findGroupForId (nowGroupId, templateList) { |
| 225 | // 根据组id获取组 |
| 226 | let nowGroupTemplate = null |
no outgoing calls
no test coverage detected