@ant-design-vue/nuxt

中文文档
1.4.6发布于 2024/11/11MITTypeScriptESM + CJS近 30 天下载 1.8万

ant-design-vue-nuxt module

原始使用文档
文档目录9 节
  1. Features
  2. Quick Setup
  3. Usage
  4. Options
  5. components
  6. imports
  7. icons
  8. extractStyle (1.4.1)
  9. Development

Ant Design Vue Nuxt

npm version npm downloads License Nuxt

Ant Design Vue module for Nuxt

Features

  • ✨  Automatically import components on demand.
  • ✨  Automatically import icons from @ant-design/icons-vue.
  • ✨  Automatically import of message, notification and Modal methods.

Quick Setup

  1. Add @ant-design-vue/nuxt dependency to your project
npx nuxi@latest module add ant-design-vue
  1. Add @ant-design-vue/nuxt to the modules section of nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    '@ant-design-vue/nuxt'
  ],
  antd:{
    // Options
  }
})

That's it! You can now use ant-design-vue in your Nuxt app ✨

Usage

Online Playground

<script lang="ts" setup>
const handleMessage = () => {
  message.info("This is a normal message");
}
</script>
<template>
  <a-button @click="handleMessage">
    button
  </a-button>
</template>

Reference Nuxt documentation and playground use.

Options

components

  • Type: array | 'false'

If there are components that are not imported automatically from Ant Design Vue, you need to add the component name here.

e.g.['Button']

imports

  • Type: array

If you wish to add automatically import content from Ant Design Vue, you can add it here.

icons

  • Type: array | 'false'

If there are components that are not imported automatically from @ant-design/icons-vue, you need to add the component name here.

extractStyle (1.4.1)

  • Type: boolean

Solve page css flicker problem

Extracts and injects css on demand, defaults to false

<!-- If the extractStyle option is enabled, we can use a-extract-style on the outermost level of the template in app.vue -->
<template>
  <a-extract-style>
    <!-- Your page or component -->
  </a-extract-style>
</template>

Development

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Build for production
npm run build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

版本与发布记录

@ant-design-vue/nuxt 共发布 16 个版本,首次发布于 2023/05/31;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.4.6latest2024/11/112 年前
1.4.52024/10/232 年前
1.4.42024/09/272 年前
1.4.32024/09/272 年前
1.4.22024/06/132 年前
1.4.12024/01/122 年前

其他发布通道:alpha.0 → 1.0.0-alpha.0,alpha → 1.0.0-alpha.1。

关于 @ant-design-vue/nuxt 的常见问题

@ant-design-vue/nuxt 是什么?

ant-design-vue-nuxt module

如何安装 @ant-design-vue/nuxt?

在项目目录运行 npm install @ant-design-vue/nuxt,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:ant-design-vue(>=4)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ant-design-vue/nuxt 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ant-design-vue/nuxt 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ant-design-vue/nuxt 可以商用吗?

@ant-design-vue/nuxt 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ant-design-vue/nuxt 的下载量有多少?

根据 npm 官方下载统计,@ant-design-vue/nuxt 在 2026/10/06 – 2026/11/04 这 30 天内被下载 18,002 次,日均约 600 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ant-design-vue/nuxt 还在维护吗?

最新版本 1.4.6 发布于 2024/11/11(2 年前);至今共发布 16 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/05/31。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。