升级到 vue3

This commit is contained in:
lyswhut
2021-12-03 22:11:11 +08:00
parent c6635e554a
commit 8059d9cd73
260 changed files with 14443 additions and 10979 deletions
+7 -9
View File
@@ -1,5 +1,5 @@
import Vue from 'vue'
import Router from 'vue-router'
// import Vue from 'vue'
import { createRouter, createWebHashHistory } from 'vue-router'
import paths from './paths'
@@ -14,12 +14,10 @@ function route(path, view, name, meta, props) {
}
}
Vue.use(Router)
const router = new Router({
mode: 'hash',
const router = createRouter({
history: createWebHashHistory(),
routes: paths.map(path => route(path.path, path.view, path.name, path.meta, path.props)).concat([
{ path: '*', redirect: '/search' },
{ path: '/:pathMatch(.*)*', redirect: { name: 'search' } },
]),
linkActiveClass: 'active-link',
linkExactActiveClass: 'exact-active-link',
@@ -39,8 +37,8 @@ const router = new Router({
if (to.matched.some(m => m.meta.scrollToTop)) {
// cords will be used if no selector is provided,
// or if the selector didn't match any element.
position.x = 0
position.y = 0
position.left = 0
position.top = 0
}
// if the returned position is falsy or an empty object,
// will retain current scroll position.
+7 -8
View File
@@ -12,21 +12,20 @@ export default [
name: 'search',
view: 'Search',
},
{
path: '/songList',
name: 'songList',
view: 'songList/SongList',
},
{
path: '/leaderboard',
name: 'leaderboard',
view: 'Leaderboard',
},
{
path: '/songList',
name: 'songList',
view: 'SongList',
},
{
path: '/list',
name: 'list',
view: 'List',
// props: true,
view: 'list/List',
},
{
path: '/download',
@@ -36,6 +35,6 @@ export default [
{
path: '/setting',
name: 'setting',
view: 'Setting',
view: 'setting/Setting',
},
]