word 文档搜索修改
This commit is contained in:
parent
acdd310656
commit
04f81d279a
|
|
@ -327,10 +327,18 @@ export default {
|
||||||
if (!this.docRendered) {
|
if (!this.docRendered) {
|
||||||
this.prepareSearchSegments()
|
this.prepareSearchSegments()
|
||||||
}
|
}
|
||||||
|
// 立即设置 searching 状态,确保动画能够显示
|
||||||
this.searching = true
|
this.searching = true
|
||||||
|
// 使用 requestAnimationFrame 确保 DOM 更新后再执行搜索
|
||||||
await this.$nextTick()
|
await this.$nextTick()
|
||||||
|
await new Promise(resolve => requestAnimationFrame(() => {
|
||||||
|
requestAnimationFrame(resolve)
|
||||||
|
}))
|
||||||
try {
|
try {
|
||||||
this.highlightMatches()
|
// 执行搜索,确保有足够时间显示动画
|
||||||
|
const searchPromise = Promise.resolve(this.highlightMatches())
|
||||||
|
const minDelayPromise = new Promise(resolve => setTimeout(resolve, 300))
|
||||||
|
await Promise.all([searchPromise, minDelayPromise])
|
||||||
} finally {
|
} finally {
|
||||||
this.searching = false
|
this.searching = false
|
||||||
}
|
}
|
||||||
|
|
@ -1014,9 +1022,19 @@ export default {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-toolbar.is-searching::after {
|
.search-toolbar.is-searching {
|
||||||
border-color: rgba(43, 104, 255, 0.4);
|
&::after {
|
||||||
animation: search-pulse 1.2s ease-in-out infinite;
|
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 {
|
@keyframes search-pulse {
|
||||||
|
|
@ -1100,6 +1118,17 @@ export default {
|
||||||
.search-icon {
|
.search-icon {
|
||||||
background: #2b68ff;
|
background: #2b68ff;
|
||||||
color: #fff;
|
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 {
|
.search-icon:hover {
|
||||||
|
|
@ -1107,6 +1136,20 @@ export default {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-icon:disabled {
|
||||||
|
opacity: 0.8;
|
||||||
|
cursor: wait;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes rotating {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.search-status {
|
.search-status {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue