Browse Source

bug修复

徐勤民 6 months ago
parent
commit
6701a3a4e9
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/main/ets/utils/ToolsHelper.ets

+ 13 - 0
src/main/ets/utils/ToolsHelper.ets

@@ -196,4 +196,17 @@ export class ToolsHelper {
       console.log('>>>>>', JSON.stringify(error))
     })
   }
+
+  /**
+   * 获取调用栈第一个类
+   */
+  static getStackKey() {
+    let stack = new Error().stack
+    if (stack) {
+      let list = JSON.stringify(stack).split('\\n')
+      let a = list[list.length-2].split(':')[0].split('(')[1]
+      return a
+    }
+    return undefined
+  }
 }