提交 5b0695f1 authored 作者: matian's avatar matian

Merge remote-tracking branch 'origin/master'

...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
import TreeItem from './TreeItem.vue' import TreeItem from './TreeItem.vue'
const navList = [ const navList = [
{ name: '首页', path: '/' }, { name: '首页', path: '/home' },
{ name: '产品体系', path: '/#product' }, { name: '产品体系', path: '/home#product' },
{ name: '精品课程', path: '/shop' }, { name: '精品课程', path: '/shop' },
{ name: '师资展示', path: '/#teacher' }, { name: '师资展示', path: '/home#teacher' },
{ name: '预约报名', path: '/#contact' } { name: '预约报名', path: '/home#contact' }
] ]
</script> </script>
......
...@@ -29,7 +29,7 @@ function toggleVisible(event: Event) { ...@@ -29,7 +29,7 @@ function toggleVisible(event: Event) {
<li class="tree-item" :class="{ 'is-active': isActive }"> <li class="tree-item" :class="{ 'is-active': isActive }">
<div class="cell" :class="{ bold: isFolder }" @click.capture="toggleVisible"> <div class="cell" :class="{ bold: isFolder }" @click.capture="toggleVisible">
<div class="cell-title"> <div class="cell-title">
<a :href="item.path">{{ item.name }}</a> <router-link :to="item.path">{{ item.name }}</router-link>
</div> </div>
<div class="cell-icon" v-if="isFolder"> <div class="cell-icon" v-if="isFolder">
<i class="el-icon-arrow-up" v-if="isOpen"></i> <i class="el-icon-arrow-up" v-if="isOpen"></i>
......
...@@ -3,7 +3,7 @@ import AppLayout from '@/components/layout/Index.vue' ...@@ -3,7 +3,7 @@ import AppLayout from '@/components/layout/Index.vue'
export const routes: Array<RouteRecordRaw> = [ export const routes: Array<RouteRecordRaw> = [
{ {
path: '/', path: '/home',
component: AppLayout, component: AppLayout,
props: { fixed: true }, props: { fixed: true },
children: [{ path: '', component: () => import('./views/Index.vue') }] children: [{ path: '', component: () => import('./views/Index.vue') }]
......
...@@ -2,12 +2,15 @@ import { createRouter, createWebHistory } from 'vue-router' ...@@ -2,12 +2,15 @@ import { createRouter, createWebHistory } from 'vue-router'
// import { useUserStore } from '@/stores/user' // import { useUserStore } from '@/stores/user'
const router = createRouter({ const router = createRouter({
scrollBehavior() { scrollBehavior(to) {
if (to.hash) {
return { el: to.hash, top: 94 }
}
// 始终滚动到顶部 // 始终滚动到顶部
return { top: 0 } return { top: 0 }
}, },
history: createWebHistory(), history: createWebHistory(),
routes: [{ path: '/:pathMatch(.*)*', redirect: '/' }] routes: [{ path: '/:pathMatch(.*)*', redirect: '/home' }]
}) })
// router.beforeEach((to, from, next) => { // router.beforeEach((to, from, next) => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论