types: fix type error

This commit is contained in:
ckl1 2022-06-06 11:15:31 +08:00
parent a4526d7cb4
commit d66f12e0e7
5 changed files with 14 additions and 14 deletions

View File

@ -1,6 +1,6 @@
// import type { App } from 'vue' import type { AppContext } from 'vue'
import { Icon } from './Icon' import { Icon } from './Icon'
export const setupGlobCom = (app: any): void => { export const setupGlobCom = (app: AppContext['app']): void => {
app.component('Icon', Icon) app.component('Icon', Icon)
} }

View File

@ -1,13 +1,13 @@
// import type { App } from 'vue' import type { AppContext, Plugin } from 'vue'
// 需要全局引入一些组件如ElScrollbar不然一些下拉项样式有问题 // 需要全局引入一些组件如ElScrollbar不然一些下拉项样式有问题
import { ElLoading, ElScrollbar } from 'element-plus' import { ElLoading, ElScrollbar } from 'element-plus'
const plugins = [ElLoading] const plugins = [ElLoading] as Plugin[]
const components = [ElScrollbar] const components = [ElScrollbar]
export const setupElementPlus = (app: any) => { export const setupElementPlus = (app: AppContext['app']) => {
plugins.forEach((plugin) => { plugins.forEach((plugin) => {
app.use(plugin) app.use(plugin)
}) })

View File

@ -1,4 +1,4 @@
// import type { App } from 'vue' import type { AppContext, Plugin } from 'vue'
import { createI18n } from 'vue-i18n' import { createI18n } from 'vue-i18n'
import { useLocaleStoreWithOut } from '@/store/modules/locale' import { useLocaleStoreWithOut } from '@/store/modules/locale'
import type { I18n, I18nOptions } from 'vue-i18n' import type { I18n, I18nOptions } from 'vue-i18n'
@ -35,8 +35,8 @@ const createI18nOptions = async (): Promise<I18nOptions> => {
} }
} }
export const setupI18n = async (app: any) => { export const setupI18n = async (app: AppContext['app']) => {
const options = await createI18nOptions() const options = await createI18nOptions()
i18n = createI18n(options) as I18n i18n = createI18n(options) as I18n
app.use(i18n) app.use(i18n as Plugin)
} }

View File

@ -1,6 +1,6 @@
import { createRouter, createWebHashHistory } from 'vue-router' import { createRouter, createWebHashHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router' import type { RouteRecordRaw } from 'vue-router'
// import type { App } from 'vue' import type { AppContext, Plugin } from 'vue'
import { Layout, getParentLayout } from '@/utils/routerHelper' import { Layout, getParentLayout } from '@/utils/routerHelper'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
@ -552,8 +552,8 @@ export const resetRouter = (): void => {
}) })
} }
export const setupRouter = (app: any) => { export const setupRouter = (app: AppContext['app']) => {
app.use(router) app.use(router as Plugin)
} }
export default router export default router

View File

@ -1,4 +1,4 @@
// import type { App } from 'vue' import type { AppContext, Plugin } from 'vue'
import { createPinia } from 'pinia' import { createPinia } from 'pinia'
import piniaPluginPersist from 'pinia-plugin-persist' import piniaPluginPersist from 'pinia-plugin-persist'
@ -6,8 +6,8 @@ const store = createPinia()
store.use(piniaPluginPersist) store.use(piniaPluginPersist)
export const setupStore = (app: any) => { export const setupStore = (app: AppContext['app']) => {
app.use(store) app.use(store as Plugin)
} }
export { store } export { store }