word 文档搜索修改

This commit is contained in:
cwchen 2025-11-28 13:12:43 +08:00
parent acdd310656
commit 04f81d279a
1 changed files with 47 additions and 4 deletions

View File

@ -327,10 +327,18 @@ export default {
if (!this.docRendered) {
this.prepareSearchSegments()
}
// searching
this.searching = true
// 使 requestAnimationFrame DOM
await this.$nextTick()
await new Promise(resolve => requestAnimationFrame(() => {
requestAnimationFrame(resolve)
}))
try {
this.highlightMatches()
//
const searchPromise = Promise.resolve(this.highlightMatches())
const minDelayPromise = new Promise(resolve => setTimeout(resolve, 300))
await Promise.all([searchPromise, minDelayPromise])
} finally {
this.searching = false
}
@ -1014,11 +1022,21 @@ export default {
pointer-events: none;
}
.search-toolbar.is-searching::after {
.search-toolbar.is-searching {
&::after {
border-color: rgba(43, 104, 255, 0.4);
animation: search-pulse 1.2s ease-in-out infinite;
}
//
.search-icon {
i.el-icon-loading {
display: inline-block !important;
animation: rotating 1s linear infinite !important;
}
}
}
@keyframes search-pulse {
0% {
opacity: 0.25;
@ -1100,6 +1118,17 @@ export default {
.search-icon {
background: #2b68ff;
color: #fff;
//
i.el-icon-loading {
display: inline-block;
animation: rotating 1s linear infinite;
font-size: 16px;
}
i.el-icon-search {
font-size: 16px;
}
}
.search-icon:hover {
@ -1107,6 +1136,20 @@ export default {
color: #fff;
}
.search-icon:disabled {
opacity: 0.8;
cursor: wait;
}
@keyframes rotating {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.search-status {
display: flex;
align-items: center;