1. Use version
2. Install the vite pluginyarn add vite-plugin-style-import -D or npm i vite-plugin-style-import -D Plugin repository address: github 3.vite.config.js configurationimport vue from '@vitejs/plugin-vue' import styleImport from 'vite-plugin-style-import'; /** * @type {import('vite').UserConfig} */ export default { plugins: [ vue(), styleImport({ libs: [{ libraryName: 'ant-design-vue', esModule: true, resolveStyle: (name) => { return `ant-design-vue/es/${name}/style/css`; }, }] }) ] } 4. Test run main.js import { createApp } from 'vue' import App from './App.vue' import { Input } from 'ant-design-vue'; const app = createApp(App) app.use(Input) app.mount('#app') Used in components <template> <!-- Imported and used in script-setup, no registration required--> <Button type="primary"> Primary</Button> <!-- Use use to register components in main.js --> <a-input placeholder="Basic usage" /> </template> <script setup> import { Button } from "ant-design-vue"; </script> This is the end of this article about how to implement on-demand loading of ant-design-vue@next components in vite2.x. For more relevant vite2.x on-demand loading content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Related commands to completely uninstall nginx under ubuntu16.04
>>: MySQL uses variables to implement various sorting
This article mainly introduces the relevant solut...
When I installed php56 with brew on mac , I encou...
In the past, almost every website had a sitemap p...
1. pc-reset PC style initialization /* normalize....
It is mainly the configuration jump of the if jud...
Use JS to implement object-oriented methods to ac...
1. Download the ElasticSearch 6.4.1 installation ...
I recently installed Ubuntu 20.04 and found that ...
Table of contents 1. Memory model and runtime dat...
1. Installation Install using yum ##Automatically...
RPM package management A packaging and installati...
Table of contents 1. Prepare materials 2. Downloa...
Designers need to understand psychology reading n...
Preface Every good habit is a treasure. This arti...
Table of contents Scene Introduction Plugin Imple...