优化代码

This commit is contained in:
TOP糯米 2023-03-09 03:11:54 +08:00
parent 28e1d7717d
commit 1d48c178c1
1 changed files with 3 additions and 1 deletions

View File

@ -155,9 +155,11 @@ export default {
* 更新左侧菜单 * 更新左侧菜单
*/ */
updateMenuStatus(index) { updateMenuStatus(index) {
if (index != this.currentLeftIndex) {
this.$emit("onScroll", this.data[index].id);
}
this.currentLeftIndex = index; this.currentLeftIndex = index;
this.scrollLeftTop = index * this.menuHeight - this.wrapHeight / 2; this.scrollLeftTop = index * this.menuHeight - this.wrapHeight / 2;
this.$emit("onScroll", this.data[index].id);
}, },
/** /**
* 滚动监听 * 滚动监听