diff --git a/components/DropDown/DropDown.vue b/components/DropDown/DropDown.vue
index f72e5d6..759b222 100644
--- a/components/DropDown/DropDown.vue
+++ b/components/DropDown/DropDown.vue
@@ -20,7 +20,7 @@
-
+
@@ -61,6 +61,10 @@
this.activeIndex = -1;
}else
this.activeIndex = index
+ },
+ cancelDrop() {
+ console.log("取消遮罩");
+ this.activeIndex = -1;
}
},
diff --git a/components/DropDown/DropDownItem.vue b/components/DropDown/DropDownItem.vue
index 87ce2f2..c69318a 100644
--- a/components/DropDown/DropDownItem.vue
+++ b/components/DropDown/DropDownItem.vue
@@ -1,12 +1,13 @@
-
+
-
{{item}}
@@ -22,11 +23,43 @@
return []
}
}
- }
+ },
+ data(){
+ return{
+ activeIndex:-1
+ }
+ },
+ methods: {
+ handleMask() {
+ this.$emit('cancelDrop');
+ },
+ async handleActive(index) {
+ this.activeIndex = index;
+ // 设置一个定时器,等待200毫秒
+ const delayPromise = this.delay(200);
+ // 等待定时器完成
+ await delayPromise;
+ this.handleMask();
+ },
+ delay(ms) {
+ return new Promise((resolve) => {
+ // 设置一个定时器,并将定时器的ID存储在this.timerId中
+ this.timerId = setTimeout(() => {
+ resolve();
+ // 清除定时器
+ clearTimeout(this.timerId);
+ }, ms);
+ });
+ },
+ },
+
}