Browse Source

lookupScope 函数,查找列上的组件异常问题

luoyifan 3 years ago
parent
commit
da83d8bee5
1 changed files with 10 additions and 1 deletions
  1. 10 1
      src/lib/lib.ts

+ 10 - 1
src/lib/lib.ts

@@ -113,7 +113,12 @@ export function lookupFn(scope: Scope, event: string): Function {
     const keys: any[] = []
     const values: any[] = []
     _.forOwn(data, (value, key) => {
-        keys.push(key)
+        const idxKey = key.indexOf('//')
+        if (idxKey >= 0) {
+            keys.push(key.substr(0, idxKey))
+        } else {
+            keys.push(key)
+        }
         values.push(value)
     })
 
@@ -141,6 +146,10 @@ export function lookupScope(extHandle: any): Scope {
     if (extHandle.isScope) {
         return extHandle
     }
+    if (extHandle.column) {
+        // 列上的组件
+        return extHandle.column.lookupReferenceHolder().yvanScope
+    }
     const vm = extHandle.lookupViewModel()
     return vm.yvanScope
 }