perf: 滑动列表自动隐藏键盘

This commit is contained in:
Pang 2024-03-09 10:35:44 +08:00
parent 55a922c7b3
commit 9be0642ba5
2 changed files with 24 additions and 1 deletions

View File

@ -243,6 +243,17 @@ export default {
}, 300) }, 300)
}, },
/**
* 内容区域触摸开始事件
* @param e
*/
onContentTouchStart(e) {
const focusedElement = document.activeElement;
if (focusedElement) {
focusedElement.blur();
}
},
/** /**
* 滚动区域滚动事件 * 滚动区域滚动事件
* @param e * @param e
@ -383,6 +394,7 @@ export default {
ref: 'content', ref: 'content',
class: this.contentClass, class: this.contentClass,
on: { on: {
touchstart: this.onContentTouchStart,
scroll: this.onContentScroll, scroll: this.onContentScroll,
mouseenter: this.onContentMouseenter, mouseenter: this.onContentMouseenter,
} }

View File

@ -11,7 +11,7 @@
</Input> </Input>
</div> </div>
</div> </div>
<ul @scroll="operateVisible = false"> <ul @touchstart="onTouchStart" @scroll="onScroll">
<template v-if="projectLists.length === 0"> <template v-if="projectLists.length === 0">
<li v-if="projectKeyLoading > 0" class="loading"><Loading/></li> <li v-if="projectKeyLoading > 0" class="loading"><Loading/></li>
<li v-else class="nothing"> <li v-else class="nothing">
@ -153,6 +153,17 @@ export default {
this.goForward({name: 'manage-' + path, params: params || {}}); this.goForward({name: 'manage-' + path, params: params || {}});
}, },
onTouchStart(e) {
const focusedElement = document.activeElement;
if (focusedElement) {
focusedElement.blur();
}
},
onScroll(e) {
this.operateVisible = false
},
modalPercent(item) { modalPercent(item) {
if (this.operateVisible) { if (this.operateVisible) {
return return