官网文档
- antdv官网 https://2x.antdv.com/docs/vue...
- unplugin-vue-components按需导入插件 https://www.npmjs.com/package...
安装antdv
yarn add ant-design-vue@next
Vite配置按需导入
- 安装vite按需导入插件
yarn add -D unplugin-vue-components
;vite-plugin-components
插件已renamed tounplugin-vue-components
配置vite.config.js:
import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import Components from 'unplugin-vue-components/vite' import {AntDesignVueResolver } from 'unplugin-vue-components/resolvers' // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue(), Components({ resolvers: [ AntDesignVueResolver() ], dts: true, // enabled by default if `typescript` is installed }) ] })
组件无需导入使用(
import HelloWorld
被注释)<script setup> // This starter template is using Vue 3 <script setup> SFCs // Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup // import HelloWorld from './components/HelloWorld.vue' </script> <template> <img alt="Vue logo" src="./assets/logo.png" /> <HelloWorld msg="Hello Vue 3 + Vite" /> <p>按需导入</p> </template> <style> #app { font-family: Avenir, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; color: #2c3e50; margin-top: 60px; } </style>
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。