You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
592 B
TypeScript
19 lines
592 B
TypeScript
|
1 month ago
|
// plugins/element-plus.ts
|
||
|
|
import { defineNuxtPlugin } from '#app';
|
||
|
|
import ElementPlus from 'element-plus';
|
||
|
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
|
||
|
|
import 'element-plus/dist/index.css';
|
||
|
|
import { ElMessageBox } from 'element-plus';
|
||
|
|
|
||
|
|
export default defineNuxtPlugin((nuxtApp) => {
|
||
|
|
// 注册 Element Plus
|
||
|
|
nuxtApp.vueApp.use(ElementPlus);
|
||
|
|
|
||
|
|
// 注册所有图标
|
||
|
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||
|
|
nuxtApp.vueApp.component(key, component);
|
||
|
|
}
|
||
|
|
|
||
|
|
// 挂载到全局属性
|
||
|
|
nuxtApp.provide('messageBox', ElMessageBox);
|
||
|
|
});
|