perf: 优化再次点击抖动

This commit is contained in:
kuaifan 2023-02-27 10:51:12 +08:00
parent b64b1cd654
commit ca4a0eb0d3

View File

@ -510,9 +510,16 @@ export default {
if (index > -1) { if (index > -1) {
const el = this.$refs[`dialog_${this.dialogList[index]?.id}`] const el = this.$refs[`dialog_${this.dialogList[index]?.id}`]
if (el && el[0]) { if (el && el[0]) {
if (el[0].classList.contains("common-shake")) {
return
}
$A.scrollIntoViewIfNeeded(el[0]) $A.scrollIntoViewIfNeeded(el[0])
el[0].classList.remove("common-shake") requestAnimationFrame(_ => {
requestAnimationFrame(_ => el[0].classList.add("common-shake")) el[0].classList.add("common-shake")
setTimeout(_ => {
el[0].classList.remove("common-shake")
}, 600)
})
} }
} }
}, },