vue.js - 如何以正确的方式在 Nuxt 项目中添加 Vuepress?

标签 vue.js nuxt.js vuepress

我有我的 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/

相关文章:

javascript - vue 异步加载组件点击

vue.js - 如何通过单击启用禁用的文本字段

vue.js - 在 Vue Component 中解析 webpack 图片源(在 Vuepress 中)

vue.js - 带有简单数组的 V-for : what key to use?

javascript - Vue.js + vue-resource + vue-router = 词法声明错误?

firebase - 在 vuex 操作中访问 this.$fireStore (Nuxt.js)

javascript - 如何在 Nuxt 中使路由区分大小写

vue.js - Nuxt.js 路由 URL 不带破折号/

vue.js - 将 .vuepress 文件夹存储在另一个目录中

vue.js - fontawesome 错误 "Could not find one or more icon"