vue-pro/yudao-ui-admin-uniapp/uni_modules/uni-popup/components/uni-popup/popup.js
2022-08-03 11:52:35 +08:00

27 lines
418 B
JavaScript

export default {
data() {
return {
}
},
created(){
this.popup = this.getParent()
},
methods:{
/**
* 获取父元素实例
*/
getParent(name = 'uniPopup') {
let parent = this.$parent;
let parentName = parent.$options.name;
while (parentName !== name) {
parent = parent.$parent;
if (!parent) return false
parentName = parent.$options.name;
}
return parent;
},
}
}