From e717135aa986827ebf0a42cdee70ebf888d98987 Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Tue, 29 Dec 2020 09:33:37 +0800 Subject: [PATCH] 优化顶部导航显示与交互 --- common/Tools.js | 52 ++++++++++++++++++++++++++-------------------------- 1 files changed, 26 insertions(+), 26 deletions(-) diff --git a/common/Tools.js b/common/Tools.js index 57a1073..6e240f6 100644 --- a/common/Tools.js +++ b/common/Tools.js @@ -177,32 +177,32 @@ return true; } - static getObjDataByPath(obj, path) { - const arr = path.split('.'); - const reg2 = /\[(.*)]/g; - const reg4 = /\w+(?=\[)|(?<=\[)(.*?)(?=])/g; - let stack = []; - let temp; - arr.forEach(item => { - if (reg2.test(item)) { - while ((temp = reg4.exec(item))) { - stack.push(temp[0]); - } - } else { - stack.push(item); - } - }); - stack = stack.map(item => { - return item.replace(/^['"`]|['"`]$/g, ''); - }); - try { - return stack.reduce((pre, next) => { - return pre[next]; - }, obj); - } catch (err) { - return undefined; - } - } + // static getObjDataByPath(obj, path) { + // const arr = path.split('.'); + // const reg2 = /\[(.*)]/g; + // const reg4 = /\w+(?=\[)|(?<=\[)(.*?)(?=])/g; + // let stack = []; + // let temp; + // arr.forEach(item => { + // if (reg2.test(item)) { + // while ((temp = reg4.exec(item))) { + // stack.push(temp[0]); + // } + // } else { + // stack.push(item); + // } + // }); + // stack = stack.map(item => { + // return item.replace(/^['"`]|['"`]$/g, ''); + // }); + // try { + // return stack.reduce((pre, next) => { + // return pre[next]; + // }, obj); + // } catch (err) { + // return undefined; + // } + // } /** * 统计字符串占位宽度 -- Gitblit v1.9.1