Skip to content

快速开始

快速创建一个 nuxt3 项目

shell
npx nuxi@latest init <project-name>

创建完成后需要使用包管理工具下载依赖,推荐使用 pnpm

shell
pnpm i

安装常用扩展包

nuxt 的扩展包可以去 nuxt modules 查看

这里我安装一些常用的扩展包

  1. unocss 原子样式库
shell
pnpm add @unocss/nuxt
  1. eslint
shell
pnpm add -D eslint

搭配 antfu 的 eslint 格式化插件使用

shell
pnpm add -D @antfu/eslint-config

创建 .eslintrc 文件

json
{
  "extends": ["@antfu"],
  "plugins": []
}
  1. 图片处理
shell
pnpm add @nuxt/image
  1. lodash
shell
pnpm ass
  1. vueuse
shell
pnpm add @vueuse/nuxt @vueuse/core
  1. icons
  2. dayjs
  3. pinia 状态管理及其对应的持久化存储插件
shell
pnpm add @pinia/nuxt pinia-plugin-persistedstate
ts
export default defineNuxtConfig({
  modules: ['@pinia/nuxt'],
})