docs: how to use Element Plus in Nuxt (#11385)

docs: how to use in Nuxt
This commit is contained in:
qiang 2023-02-02 10:28:43 +08:00 committed by GitHub
parent b7fd75f75a
commit 279bf6d9c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,6 +100,25 @@ module.exports = {
For more bundlers ([Rollup](https://rollupjs.org/), [Vue CLI](https://cli.vuejs.org/)) and configs please reference [unplugin-vue-components](https://github.com/antfu/unplugin-vue-components#installation) and [unplugin-auto-import](https://github.com/antfu/unplugin-auto-import#install).
#### Nuxt
For Nuxt users, you only need to install `@element-plus/nuxt`.
```shell
npm install -D @element-plus/nuxt
```
Then add the code below into your config file.
```ts
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@element-plus/nuxt'],
})
```
Refer to the [docs](https://github.com/element-plus/element-plus-nuxt#readme) for how to configure it.
### Manually import
Element Plus provides out of box [Tree Shaking](https://webpack.js.org/guides/tree-shaking/)
@ -149,6 +168,9 @@ import { ElMessage } from 'element-plus'
## Starter Template
We provide a [Vite Template](https://github.com/element-plus/element-plus-vite-starter).
For Nuxt users we have a [Nuxt Template](https://github.com/element-plus/element-plus-nuxt-starter).
For Laravel users we have a [Laravel Template](https://github.com/element-plus/element-plus-in-laravel-starter).
## Global Configuration