温馨提示:本文翻译自stackoverflow.com,查看原文请点击:vue.js - vuepress router-link active styling not working
vue.js vuepress

vue.js - vuepress路由器链接主动样式不起作用

发布于 2020-08-06 20:16:03

我有一个basicNotation.md文件,可以很好地路由。

<router-link to="/basicNotation">Test</router-link>

但是,当渲染并路由到它时,结果如下:

<a href="/basicNotation" class="">Test</a>

请注意,没有任何类应用于锚标记!

根据vuejs文档,渲染器应如下所示:https ://router.vuejs.org/api/#active-class

<a href="/basicNotation" class="router-link-exact-active router-link-active">Test</a>

我要去哪里错了?

查看更多

提问者
the moon is made of cheese
被浏览
15
the moon is made of cheese 2020-04-27 21:13

好的,我在路径中添加了文件扩展名:

<router-link to="/basicNotation.html">Test</router-link>

据我所知,它有效。呈现为:

<a href="/basicNotation.html" class="router-link-exact-active router-link-active">Test</a>

我仍然愿意寻求更好的解决方案。