vue2server7 7.0.46 → 7.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2server7",
3
- "version": "7.0.46",
3
+ "version": "7.0.47",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "nodemon --watch src --ext ts --exec \"ts-node src/app.ts\"",
@@ -218,3 +218,31 @@ el.style.pointerEvents = 'none'
218
218
  - 清晰
219
219
  - 可维护
220
220
  - 可扩展
221
+
222
+
223
+ type Button = {
224
+ appName: string
225
+ }
226
+
227
+ type Menu = {
228
+ children?: Menu[]
229
+ buttonChildren?: Button[]
230
+ }
231
+
232
+ export function getButtonPermissions(menuTree: Menu[]): string[] {
233
+ const set = new Set<string>()
234
+
235
+ const dfs = (nodes: Menu[]) => {
236
+ nodes.forEach(node => {
237
+ node.buttonChildren?.forEach(btn => {
238
+ if (btn.appName) set.add(btn.appName)
239
+ })
240
+
241
+ if (node.children) dfs(node.children)
242
+ })
243
+ }
244
+
245
+ dfs(menuTree)
246
+
247
+ return [...set]
248
+ }