From e4dfb76893c5977b7b3d1ecce31b093cf0255068 Mon Sep 17 00:00:00 2001 From: inter Date: Tue, 16 Sep 2025 10:39:05 +0800 Subject: [PATCH] Add File --- .../uni-popup/components/uni-popup/popup.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 uni_modules/uni-popup/components/uni-popup/popup.js diff --git a/uni_modules/uni-popup/components/uni-popup/popup.js b/uni_modules/uni-popup/components/uni-popup/popup.js new file mode 100644 index 0000000..a37fb9f --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/popup.js @@ -0,0 +1,26 @@ + +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; + }, + } +}