mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-12 13:19:31 +08:00
v1.0.0-beta 源码正式开源
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// 使用时,node = this.$parent;
|
||||
export default function getParentAttr(name, keys,node) {
|
||||
|
||||
let parent = node;
|
||||
while (parent) {
|
||||
// 父组件
|
||||
if (parent.$options?.name !== name) {
|
||||
// 如果组件的name不相等,继续上一级寻找
|
||||
parent = parent.$parent;
|
||||
} else {
|
||||
|
||||
return parent[keys];
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user