Skip to content

Commit

Permalink
perf(sidebar-layer): adjust the function call order to make the anima…
Browse files Browse the repository at this point in the history
…tion smoother

Signed-off-by: qwqcode <[email protected]>
  • Loading branch information
qwqcode committed Oct 20, 2022
1 parent 298c26c commit 44ef08d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/artalk/src/layer/sidebar-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ export default class SidebarLayer extends Component {
// viewWrap 滚动条归位
// this.$viewWrap.scrollTo(0, 0)

// 执行动画
setTimeout(() => {
this.$el.style.transform = 'translate(0, 0)'
}, 20)

// 管理员身份验证 (若身份失效,弹出验证窗口)
;(async () => {
const resp = await this.ctx.getApi().user.loginStatus()
Expand All @@ -76,9 +71,6 @@ export default class SidebarLayer extends Component {
}
})()

// 清空 unread
this.ctx.updateNotifies([])

// 第一次加载
if (this.firstShow) {
this.$iframeWrap.innerHTML = ''
Expand Down Expand Up @@ -114,6 +106,16 @@ export default class SidebarLayer extends Component {
this.iframeLoad(this.$iframe!.src.replace('&darkMode=1', ''))
}

// 执行滑动显示动画
setTimeout(() => {
this.$el.style.transform = 'translate(0, 0)'
}, 100)

// 清空 unread
setTimeout(() => {
this.ctx.updateNotifies([])
}, 0)

this.ctx.trigger('sidebar-show')
}

Expand Down

0 comments on commit 44ef08d

Please sign in to comment.