Browse Source

切换新页面跳转到顶部

master
maochaoying 2 years ago
parent
commit
e5c7c27101
  1. 4
      src/components/Top.vue
  2. 5
      src/router/index.js

4
src/components/Top.vue

@ -27,7 +27,9 @@
<div class="btn" @click="toPage('/case-show')">案例展示</div>
<div class="btn" @click="toPage('/contact')">联系我们</div>
<div class="btn" @click="toPage('/recruit')">招贤纳士</div>
<div class="btn" @click="toPage('/hardware')">软硬件研发</div>
<div class="btn" @click="toPage(`${isHard ? '/' : '/hardware'}`)">
{{ isHard ? '工业设计' : '软硬件研发' }}
</div>
<div class="btn" @click="toPage('/product')">产品研发</div>
</div>
</div>

5
src/router/index.js

@ -27,4 +27,9 @@ const router = createRouter({
history: createWebHashHistory(),
})
// 跳转后返回顶部
router.afterEach((to, from, next) => {
window.scrollTo(0, 0)
})
export default router
Loading…
Cancel
Save