Skip to content

VuePress搭建

约 251 字小于 1 分钟

Vue

2024-03-16

属性类型默认值说明
titlestring默认自动填入文件名文章标题
createTimestring当前时间文章创建时间
authorstring默认自动填入 avatar.name文章作者
tagsstring[][]文章标签
stickyboolean | numberfalse是否置顶, 如果为数字,则数字越大,置顶越靠前
articlebooleantrue是否在列表页中显示

1.初始化

npm init

2.安装 vuepress

npm i -D vuepress@next
# 安装 主题和打包工具
npm i -D vuepress-theme-plume @vuepress/bundler-vite@next

3.在 package.json 中添加 script

package.json

{
  "scripts": {
    "dev": "vuepress dev docs",
    "build": "vuepress build docs"
  }
}

4.新增 .gitignore

node_modules
.temp
.cache

5.在 .vuepress/config.{js,ts} 中配置主题

.vuepress/config.ts mkdir .vuepresstouch config.ts

import { defineUserConfig } from 'vuepress'
import { viteBundler } from '@vuepress/bundler-vite'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
  // 请不要忘记设置默认语言
  lang: 'zh-CN',
  theme: plumeTheme({
    // more...
  }),
  bundler: viteBundler(),
})

6. 启动

npm run dev

![[Pasted image 20240313144330.png|300]]

修改默认信息

node_modules/vuepress-theme-plume/lib/node/defaultOptioons.js

node18.16.0报错import {addAbortListener} from 'node:events';
升级node