File tree 1 file changed +4
-5
lines changed
src/pages/home/components
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 1
1
<script setup name="LeftBar">
2
2
import { reactive , ref , onMounted } from " vue" ;
3
- import { useRouter } from " vue-router" ;
4
- import { toUrl } from " /src/utils/utils.js" ;
3
+ import { useRouter , RouterLink } from " vue-router" ;
5
4
6
5
// 该变量将在左侧边栏组件加载时设定
7
6
// 记录有多少个分类可以被展开,由视图 (Viewport) 垂直高度决定
@@ -215,14 +214,14 @@ onMounted(() => {
215
214
</div >
216
215
<Transition name =" menu" >
217
216
<ul class =" py-[3px] flex nav-container" v-show =" item1.show" >
218
- <a
219
- @click.prevent = " toUrl( item2.link) "
217
+ <router-link
218
+ :to = " item2.link"
220
219
v-for =" item2 in item1.children"
221
220
:key =" item2.title"
222
221
:href =" item2.link"
223
222
:class =" { 'bg-[#dcdcdc]': $route.path.trim().startsWith(item2.link.trim()) }"
224
223
class =" leading-4 navitem-flex hover:bg-[#dcdcdc] cursor-pointer pr-[10px] pl-[16px] block text-wrap select-none href-noline"
225
- >{{ item2.title }}</a >
224
+ >{{ item2.title }}</router-link >
226
225
</ul >
227
226
</Transition >
228
227
</div >
You can’t perform that action at this time.
0 commit comments