wangrong
2026-08-30 4c949c0dc9bcae785c281c9d8125295f09810b15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import type { App } from 'vue'
 
// 需要全局引入一些组件,如ElScrollbar,不然一些下拉项样式有问题
import { ElLoading, ElScrollbar } from 'element-plus-secondary'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus-secondary/theme-chalk/el-radio-button.css'
import { ElConfigProvider } from 'element-plus-secondary'
 
const plugins = [ElLoading]
 
const components = [ElScrollbar]
 
export const setupElementPlus = (app: App<Element>) => {
  plugins.forEach(plugin => {
    app.use(plugin)
  })
 
  components.forEach(component => {
    app.component(component.name, component)
  })
}
 
// 全局引用element Icon 图标
export const setupElementPlusIcons = (app: App<Element>) => {
  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }
}
 
// 修改 setElementPlusLocale 函数以使用 ElConfigProvider 设置国际化
export const setElementPlusLocale = (localeObj: any) => {
  ElConfigProvider.locale = localeObj
}