refactor: 重命名 plugins 目录下名称
This commit is contained in:
parent
dc48bf4880
commit
b0e93f6184
10
src/main.ts
10
src/main.ts
@ -1,10 +1,9 @@
|
||||
// core
|
||||
import App from "@/App.vue"
|
||||
import { pinia } from "@/pinia"
|
||||
import { installPlugins } from "@/plugins"
|
||||
import { router } from "@/router"
|
||||
import { createApp } from "vue"
|
||||
// load
|
||||
import { loadPlugins } from "@/plugins"
|
||||
// css
|
||||
import "uno.css"
|
||||
import "normalize.css"
|
||||
@ -14,13 +13,16 @@ import "vxe-table/lib/style.css"
|
||||
import "vxe-table-plugin-element/dist/style.css"
|
||||
import "@@/assets/styles/index.scss"
|
||||
|
||||
// 创建应用实例
|
||||
const app = createApp(App)
|
||||
|
||||
// 加载插件(全局组件、自定义指令等)
|
||||
loadPlugins(app)
|
||||
// 安装插件(全局组件、自定义指令等)
|
||||
installPlugins(app)
|
||||
|
||||
// 安装 pinia 和 router
|
||||
app.use(pinia).use(router)
|
||||
|
||||
// router 准备就绪后挂载应用
|
||||
router.isReady().then(() => {
|
||||
app.mount("#app")
|
||||
})
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { App } from "vue"
|
||||
import * as ElementPlusIconsVue from "@element-plus/icons-vue"
|
||||
|
||||
export function loadElementPlusIcons(app: App) {
|
||||
export function installElementPlusIcons(app: App) {
|
||||
// 注册所有 Element Plus Icon
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
app.component(key, component)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { App } from "vue"
|
||||
import ElementPlus from "element-plus"
|
||||
|
||||
export function loadElementPlus(app: App) {
|
||||
export function installElementPlus(app: App) {
|
||||
// Element Plus 组件完整引入
|
||||
app.use(ElementPlus)
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
import type { App } from "vue"
|
||||
import { loadElementPlus } from "./element-plus"
|
||||
import { loadElementPlusIcons } from "./element-plus-icons"
|
||||
import { loadPermissionDirective } from "./permission-directive"
|
||||
import { loadSvgIcons } from "./svg-icons"
|
||||
import { loadVxeTable } from "./vxe-table"
|
||||
import { installElementPlus } from "./element-plus"
|
||||
import { installElementPlusIcons } from "./element-plus-icons"
|
||||
import { installPermissionDirective } from "./permission-directive"
|
||||
import { installSvgIcons } from "./svg-icons"
|
||||
import { installVxeTable } from "./vxe-table"
|
||||
|
||||
export function loadPlugins(app: App) {
|
||||
loadElementPlus(app)
|
||||
loadElementPlusIcons(app)
|
||||
loadPermissionDirective(app)
|
||||
loadSvgIcons(app)
|
||||
loadVxeTable(app)
|
||||
export function installPlugins(app: App) {
|
||||
installElementPlus(app)
|
||||
installElementPlusIcons(app)
|
||||
installPermissionDirective(app)
|
||||
installSvgIcons(app)
|
||||
installVxeTable(app)
|
||||
}
|
||||
|
@ -20,6 +20,6 @@ const permission: Directive = {
|
||||
}
|
||||
}
|
||||
|
||||
export function loadPermissionDirective(app: App) {
|
||||
export function installPermissionDirective(app: App) {
|
||||
app.directive("permission", permission)
|
||||
}
|
||||
|
@ -2,6 +2,6 @@ import type { App } from "vue"
|
||||
import SvgIcon from "@@/components/SvgIcon/index.vue" // Svg Component
|
||||
import "virtual:svg-icons-register"
|
||||
|
||||
export function loadSvgIcons(app: App) {
|
||||
export function installSvgIcons(app: App) {
|
||||
app.component("SvgIcon", SvgIcon)
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ VXETable.setConfig({
|
||||
}
|
||||
})
|
||||
|
||||
export function loadVxeTable(app: App) {
|
||||
export function installVxeTable(app: App) {
|
||||
// Vxe Table 组件完整引入
|
||||
app.use(VXETable)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user