我有我的 Nuxt 应用程序,我正在尝试在其上添加 Vuepress。
我做了 yarn add vuepress@next -D
然后创建了 docs
文件夹和 readme.md
文件在那里。
问题:如果 .vuepress
,项目仅显示侧边栏和导航栏文件夹在 docs
之外文件夹;如果它在里面,它将无法工作 - 不遵守 config.js 规则。
此外,它正在识别 Nuxt 应用程序中的 readme.md(也在 docs 文件夹之外),而不是 docs 文件夹中的那个。
任何人都可以帮助我吗?
另一个问题,如果上述方法有效,我是否可以通过 localhost:3000/docs
访问?而不是 localhost:3000
用于 Nuxt 项目和 localhost:8080
对于文档?
这是我当前的文件夹结构(没有显示侧边栏 - 不尊重 .vuepress 文件夹中的 config.js):
docs
|__.vuepress
| |__config.js
|
|__guides
config.js 文件:
module.exports = {
title: 'Documentation',
description: 'Documentation',
themeConfig: {
sidebar: 'auto',
nav: [{
text: 'Home',
link: '/'
},
{
text: 'Guides A',
link: '/guides/apis/'
},
{
text: 'item with subitems',
items: [{
text: 'Subitem 01',
link: '/'
},
{
text: 'SubItem 02',
link: '/'
}
]
},
{
text: 'External',
link: 'https://google.com'
},
]
}
}
Vuepress 版本 1.0.2
谢谢。
最佳答案
为什么你需要同时使用这两个?如果你使用 Nuxt,你实际上并不需要 VuePress。查看官方VuePress documentation .
Nuxt
Nuxt is capable of doing what VuePress does, but it is designed for building applications. VuePress is focused on content-centric static sites and provides features tailored for technical documentation out of the box.
关于vue.js - 如何以正确的方式在 Nuxt 项目中添加 Vuepress?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56729097/