[Bugfix] Fix navbar not showing on mobile clients(#3419) & image relative path problem (#3427)

This commit is contained in:
hffariel
2020-05-06 11:57:03 +08:00
committed by GitHub
parent caa7a07c70
commit dafb356b42
4 changed files with 23 additions and 59 deletions

View File

@ -34,6 +34,7 @@ before_script:
- echo $BRANCH
- sed -i 's/base:.*,/base:\"\/'$BRANCH'\/\",/g' .vuepress/config.js
- sed -i 's/docsBranch:.*,/docsBranch:\"'$BRANCH'\",/g' .vuepress/config.js
- find ./ -name "*.md" -exec sed -i -e 's/!\[\(.*\)\][(]\(.*\)[)]/<img \:src=\"$withBase\('\''\2'\''\)\" alt=\"\1\">/g' {} \;
- rm -rf site-repo
script:

View File

@ -427,7 +427,7 @@ module.exports = [
children: ["debug-tool", "format-code"],
},
{
title: "Apache Commnity",
title: "Apache Community",
directoryPath: "community/",
children: [
"gitter",

View File

@ -1,56 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<template>
<div>
<ParentLayout v-if="showNavBar"></ParentLayout>
</div>
</template>
<script>
import ParentLayout from "@parent-theme/components/NavLinks.vue";
import DropdownLink from "@theme/components/DropdownLink.vue";
import axios from "axios";
export default {
data: () => ({
showNavBar: false
}),
components: {
ParentLayout
},
mounted() {
if (this.$site.themeConfig.hasFetchedVersions) return;
this.$site.themeConfig.hasFetchedVersions = true;
axios
.get("/versions.json")
.then(res => {
Object.keys(this.$site.themeConfig.locales).forEach(k => {
this.$site.themeConfig.locales[k].nav = this.$site.themeConfig.locales[k].nav.concat(
res.data[k.replace(/\//gi, "")] || []
);
});
this.showNavBar = true;
})
.catch(err => {
this.showNavBar = true;
console.log(err);
});
}
};
</script>

View File

@ -18,7 +18,7 @@ under the License.
-->
<template>
<ParentLayout>
<ParentLayout :key="renderIndex">
<Content></Content>
<footer slot="page-bottom">
<CustomFooter />
@ -28,11 +28,30 @@ under the License.
<script>
import ParentLayout from "@parent-theme/layouts/Layout.vue";
import CustomFooter from "@theme/components/Footer.vue";
import axios from "axios"
export default {
components: {
ParentLayout,
CustomFooter
}
},
data: () => ({ renderIndex: 0 }),
mounted() {
// fetching versions from asf-site repo
axios
.get("/versions.json")
.then(res => {
Object.keys(this.$site.themeConfig.locales).forEach(k => {
this.$site.themeConfig.locales[k].nav = this.$site.themeConfig.locales[k].nav.concat(
res.data[k.replace(/\//gi, "")] || []
)
})
this.renderIndex = 1
})
.catch(err => {
this.renderIndex = 1
console.log(err)
})
}
};
</script>