diff --git a/packages/src/index.vue b/packages/src/index.vue index 32cb94b..7a4ee3c 100644 --- a/packages/src/index.vue +++ b/packages/src/index.vue @@ -211,10 +211,11 @@ export default { /** * 选择标题跳到对应内容 */ - selectNav (nav, index) { + async selectNav (nav, index) { + this.scrollContainer.scrollTop = this.offsetTops[`content${index}`] - this.scrollDeviation; + await this.$nextTick(); this.resetNavSelect(); nav.checked = true; - this.scrollContainer.scrollTop = this.offsetTops[`content${index}`] - this.scrollDeviation; }, resetNavSelect () { this.navMenu.forEach(item => { diff --git a/src/App.vue b/src/App.vue index 0334b0c..8bebea0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -10,6 +10,7 @@