diff --git a/src/components/index.ts b/src/components/index.ts index 0458c180e..4d030c379 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1,6 +1,6 @@ -import type { AppContext } from 'vue' +import type { App } from 'vue' import { Icon } from './Icon' -export const setupGlobCom = (app: AppContext['app']): void => { +export const setupGlobCom = (app: App): void => { app.component('Icon', Icon) } diff --git a/src/plugins/elementPlus/index.ts b/src/plugins/elementPlus/index.ts index f2a226ff9..a5362a1c6 100644 --- a/src/plugins/elementPlus/index.ts +++ b/src/plugins/elementPlus/index.ts @@ -1,13 +1,13 @@ -import type { AppContext, Plugin } from 'vue' +import type { App } from 'vue' // 需要全局引入一些组件,如ElScrollbar,不然一些下拉项样式有问题 import { ElLoading, ElScrollbar } from 'element-plus' -const plugins = [ElLoading] as Plugin[] +const plugins = [ElLoading] const components = [ElScrollbar] -export const setupElementPlus = (app: AppContext['app']) => { +export const setupElementPlus = (app: App) => { plugins.forEach((plugin) => { app.use(plugin) }) diff --git a/src/plugins/vueI18n/index.ts b/src/plugins/vueI18n/index.ts index b2adae4e4..f845b13f7 100644 --- a/src/plugins/vueI18n/index.ts +++ b/src/plugins/vueI18n/index.ts @@ -1,4 +1,4 @@ -import type { AppContext, Plugin } from 'vue' +import type { App } from 'vue' import { createI18n } from 'vue-i18n' import { useLocaleStoreWithOut } from '@/store/modules/locale' import type { I18n, I18nOptions } from 'vue-i18n' @@ -35,8 +35,8 @@ const createI18nOptions = async (): Promise => { } } -export const setupI18n = async (app: AppContext['app']) => { +export const setupI18n = async (app: App) => { const options = await createI18nOptions() i18n = createI18n(options) as I18n - app.use(i18n as Plugin) + app.use(i18n) } diff --git a/src/router/index.ts b/src/router/index.ts index 8db42426f..97bdc0aac 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,6 +1,6 @@ import { createRouter, createWebHashHistory } from 'vue-router' import type { RouteRecordRaw } from 'vue-router' -import type { AppContext, Plugin } from 'vue' +import type { App } from 'vue' import { Layout, getParentLayout } from '@/utils/routerHelper' import { useI18n } from '@/hooks/web/useI18n' @@ -552,8 +552,8 @@ export const resetRouter = (): void => { }) } -export const setupRouter = (app: AppContext['app']) => { - app.use(router as Plugin) +export const setupRouter = (app: App) => { + app.use(router) } export default router diff --git a/src/store/index.ts b/src/store/index.ts index 9dca73e22..4038068be 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,4 +1,4 @@ -import type { AppContext, Plugin } from 'vue' +import type { App } from 'vue' import { createPinia } from 'pinia' import piniaPluginPersist from 'pinia-plugin-persist' @@ -6,8 +6,8 @@ const store = createPinia() store.use(piniaPluginPersist) -export const setupStore = (app: AppContext['app']) => { - app.use(store as Plugin) +export const setupStore = (app: App) => { + app.use(store) } export { store }