Demo:优化搜索,鼠标不在搜索区域内不聚焦,解决鼠标不在搜索区域内无法删除输入的文字的问题
This commit is contained in:
parent
ad6085890e
commit
d2e468287d
@ -1,11 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="searchContainer" :class="{ isDark: isDark, show: show }">
|
<div
|
||||||
|
class="searchContainer"
|
||||||
|
:class="{ isDark: isDark, show: show }"
|
||||||
|
@mouseleave="onMouseleave"
|
||||||
|
>
|
||||||
<div class="closeBtnBox">
|
<div class="closeBtnBox">
|
||||||
<span class="closeBtn el-icon-close" @click="close"></span>
|
<span class="closeBtn el-icon-close" @click="close"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="searchInputBox">
|
<div class="searchInputBox">
|
||||||
<el-input
|
<el-input
|
||||||
ref="input"
|
ref="searchInputRef"
|
||||||
:placeholder="$t('search.searchPlaceholder')"
|
:placeholder="$t('search.searchPlaceholder')"
|
||||||
size="small"
|
size="small"
|
||||||
v-model="searchText"
|
v-model="searchText"
|
||||||
@ -26,6 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<el-input
|
<el-input
|
||||||
v-if="showReplaceInput"
|
v-if="showReplaceInput"
|
||||||
|
ref="replaceInputRef"
|
||||||
:placeholder="$t('search.replacePlaceholder')"
|
:placeholder="$t('search.replacePlaceholder')"
|
||||||
size="small"
|
size="small"
|
||||||
v-model="replaceText"
|
v-model="replaceText"
|
||||||
@ -97,7 +102,7 @@ export default {
|
|||||||
showSearch() {
|
showSearch() {
|
||||||
this.$bus.$emit('closeSideBar')
|
this.$bus.$emit('closeSideBar')
|
||||||
this.show = true
|
this.show = true
|
||||||
this.$refs.input.focus()
|
// this.$refs.input.focus()
|
||||||
},
|
},
|
||||||
|
|
||||||
hideReplaceInput() {
|
hideReplaceInput() {
|
||||||
@ -127,6 +132,15 @@ export default {
|
|||||||
this.searchText = ''
|
this.searchText = ''
|
||||||
this.hideReplaceInput()
|
this.hideReplaceInput()
|
||||||
this.mindMap.search.endSearch()
|
this.mindMap.search.endSearch()
|
||||||
|
},
|
||||||
|
|
||||||
|
onMouseleave() {
|
||||||
|
if (this.$refs.searchInputRef) {
|
||||||
|
this.$refs.searchInputRef.blur()
|
||||||
|
}
|
||||||
|
if (this.$refs.replaceInputRef) {
|
||||||
|
this.$refs.replaceInputRef.blur()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user