uni-Identify-quality/tm-vuetify/tool/function/getParentAttr.js
2023-09-19 15:48:24 +08:00

18 lines
345 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 使用时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;
}