/** * Json对象点路径转换成全路径 * @param {Object} obj */ formatJson(obj) { Object.keys(obj).forEach(k => { if (k.includes('.')) { let arr = k.split('.'); if (arr.length > 1) { obj[arr[0]] = {}; obj[arr[0]][arr.splice(1).join('.')] = obj[k]; this.formatJson(obj[arr[0]]); delete obj[k]; } } }) }