diff --git a/src/utils/util.js b/src/utils/util.js index eaf6311..a7bcb72 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -100,7 +100,7 @@ export function dictToTree(list, tree, parentId) { if (child.children.length <= 0) { delete child.children - }else{ + } else { child.selectable = false; } @@ -110,18 +110,7 @@ export function dictToTree(list, tree, parentId) { return tree } -//列表转🌲 -// export function list2Tree(list, parentId) { -// let obj = [] -// list.forEach(item => { -// item.children = [] -// obj[item.id] = item -// }) -// return list.filter(item => { -// if (item.parentId !== parentId) { -// obj[item.parentId].children.push(item) -// return false -// } -// return true -// }) -// } +//拿地址路径中的参数,不能用$route取的就用这个取 +export function getUrlKey(name) { + return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null +}