index-admin.ts 532 B

12345678910111213141516171819202122232425
  1. import {
  2. createRouter,
  3. createWebHashHistory,
  4. createWebHistory,
  5. Router
  6. } from 'vue-router'
  7. import routes from './routes-admin'
  8. const router: Router = createRouter({
  9. // history: createWebHistory('/website'),
  10. history: createWebHashHistory(),
  11. routes,
  12. scrollBehavior() {
  13. return new Promise((resolve, reject) => {
  14. resolve({ left: 0, top: 0 })
  15. })
  16. }
  17. })
  18. router.beforeEach((to, from, next) => {
  19. const title = to.meta.title
  20. document.title = (title || '酷乐秀') as any
  21. next()
  22. })
  23. export default router