mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
25 lines
381 B
JavaScript
25 lines
381 B
JavaScript
/**
|
|
* find parent component by name
|
|
*/
|
|
|
|
export const FindParentMixin = {
|
|
data() {
|
|
return {
|
|
parent: null
|
|
};
|
|
},
|
|
|
|
methods: {
|
|
findParent(name) {
|
|
let parent = this.$parent;
|
|
while (parent) {
|
|
if (parent.$options.name === name) {
|
|
this.parent = parent;
|
|
break;
|
|
}
|
|
parent = parent.$parent;
|
|
}
|
|
}
|
|
}
|
|
};
|