@lambo-design/shared 1.0.0-beta.8 → 1.0.0-beta.9
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 +1 -1
- package/utils/vxetable/index.js +15 -4
package/package.json
CHANGED
package/utils/vxetable/index.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
export const setParentRefs = (parentVm, targetVm, refKey) => {
|
|
2
2
|
let hasFind = false;
|
|
3
3
|
if (parentVm.$refs) {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
//遍历父组件的refs里注册的组件
|
|
5
|
+
Object.entries(parentVm.$refs).forEach(([parentKey, parentValue]) => {
|
|
6
|
+
//找到targetVm组件
|
|
7
|
+
if (parentValue === targetVm) {
|
|
6
8
|
hasFind = true;
|
|
7
|
-
|
|
9
|
+
//遍历targetVm组件上注册的refKey组件
|
|
10
|
+
Object.entries(targetVm.$refs[refKey]).forEach(([key, value])=>{
|
|
11
|
+
//找到refKey组件methods里面的function
|
|
12
|
+
if(key.charAt(0) !== '$'
|
|
13
|
+
&& key.charAt(0) !== '_'
|
|
14
|
+
&& typeof value == 'function'){
|
|
15
|
+
//将function添加到targetVm组件
|
|
16
|
+
parentVm.$refs[parentKey][key] = value
|
|
17
|
+
}
|
|
18
|
+
})
|
|
8
19
|
}
|
|
9
20
|
})
|
|
10
21
|
}
|
|
11
22
|
if (!hasFind && parentVm.$parent) {
|
|
12
23
|
setParentRefs(parentVm.$parent, targetVm, refKey)
|
|
13
24
|
}
|
|
14
|
-
}
|
|
25
|
+
}
|