Skip to content

Commit eacb71d

Browse files
committed
fix: fix the existence of base item and sidebar error
1 parent 4ef0abd commit eacb71d

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Aurora-theme/lib/client/components/child/side/MobileSidebarNav.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<a v-if="getIsOuterLink(menuItem.link)" target="_blank" :key="index" :href="menuItem.link">
4343
<span>{{menuItem.text}}</span>
4444
</a>
45-
<router-link v-else :to="menuItem.link">
45+
<router-link v-else :to="menuItem.link" :data="getNavHref(menuItem.link)">
4646
<span>{{menuItem.text}}</span>
4747
</router-link>
4848
</div>
@@ -289,6 +289,17 @@ export default {
289289
},
290290
},
291291
computed: {
292+
getNavHref() {
293+
return (link) => {
294+
let re = new RegExp("^"+this.$site.base);
295+
if (re.test(link)) {
296+
//link中已经带有base
297+
return link
298+
}else {
299+
return this.$site.base + link
300+
}
301+
}
302+
},
292303
getIsOuterLink() {
293304
return (item) => {
294305
let reg=/^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/;

docs/.vuepress/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const { path } = require("@vuepress/utils");
22
module.exports = {
3-
//base: '/aurora/',
3+
base: '/aurora/',
44
//https://ooszy.cco.vin/img/blog-note/aurora-loading.gif
55
extendsMarkdown: (md) => {
66

0 commit comments

Comments
 (0)