# 路由設定選項「active、切換畫面頁面自動滾動」 (7-10) ###### tags: `Vue`、`7. Router路由` 2022.3.10 #### 參考網址:https://next.router.vuejs.org/zh/api/#routeroptions ####   在 `const router` 內Vue Router官方也有提出不錯選項,可供程式撰寫使用,參考上述網址,以下會有兩項實作範例。 ## ### 範例一:添加 active 使當前路由能明顯顯示。 ####   主要針對<router-link>動作。 ``` const router = createRouter({ history: createWebHashHistory(), linkActiveClass: 'active', routes, }); ```  **成果**  ### 範例二:指定特定網頁,畫面會自動滾至指定位置。 #### 1. 新增會滾動的頁面  #### 2. 更改App.vue頁面 (navbar固定於上、新增頂端間隔) * navbar固定於上  * 新增頂端間隔  #### 3. 撰寫router滾輪函式 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up