diff --git a/docs/.vuepress/markdown/createSidebar.js b/docs/.vuepress/markdown/createSidebar.js index a572ae8909405029861fe8e2075e8d87fc9688bb..d414f44c488fda629df4ade0a2e05f9739a81946 100644 --- a/docs/.vuepress/markdown/createSidebar.js +++ b/docs/.vuepress/markdown/createSidebar.js @@ -7,7 +7,7 @@ const createSiteMap = require('./createSiteMap'); const links = [] -function parseBar(file, options) { +function parseBar(tab, file, options) { const textName = options.text || 'text' const linkName = options.link || 'link' const contents = [] @@ -39,6 +39,13 @@ function parseBar(file, options) { }) if (link && !isExternal(link)) { + if (!link.startsWith('/')) { + const linkFirstItem = link.split('/')[0] + if (tab.indexOf(linkFirstItem) === -1) { + link = `${tab}${link}` + } + } + link = path.join('/', link.replace(/\.md\b/, '') .replace(/\bREADME\b/, '') .replace(/\/index/, '/') @@ -64,7 +71,7 @@ module.exports = function (tabs = []) { const sidebar = {} tabs.forEach(tab => { - sidebar[tab] = parseBar(path.join(__dirname, '../../', tab, '_sidebar.md'), { + sidebar[tab] = parseBar(tab, path.join(__dirname, '../../', tab, '_sidebar.md'), { text: 'title', link: 'path' }) diff --git a/docs/tutorial/_sidebar.md b/docs/tutorial/_sidebar.md index a8b3f6747142842590f0ae9fbfa7828685274c24..ecea99119d77a9b6bd321cc68d0eab7317342301 100644 --- a/docs/tutorial/_sidebar.md +++ b/docs/tutorial/_sidebar.md @@ -112,7 +112,7 @@ * [小程序插件](/tutorial/mp-weixin-plugin.md) * [一键上传微信平台](/tutorial/build/publish-mp-weixin-cli.md) * 运行和调试 - * [概述](tutorial/run-and-debug.md) + * [概述](run-and-debug.md) * [web平台:内置浏览器运行调试](tutorial/debug/debug-web-via-hx.md) * [web平台:debug](tutorial/debug/debug-web-via-chrome.md) * [App平台:真机运行常见问题](tutorial/run/PhoneDebugging.md)