Skip to content

Commit

Permalink
types: fix types error
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Jun 9, 2022
1 parent d88e051 commit 586486a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -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<Element>): void => {
app.component('Icon', Icon)
}
6 changes: 3 additions & 3 deletions src/plugins/elementPlus/index.ts
Original file line number Diff line number Diff line change
@@ -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<Element>) => {
plugins.forEach((plugin) => {
app.use(plugin)
})
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/vueI18n/index.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -35,8 +35,8 @@ const createI18nOptions = async (): Promise<I18nOptions> => {
}
}

export const setupI18n = async (app: AppContext['app']) => {
export const setupI18n = async (app: App<Element>) => {
const options = await createI18nOptions()
i18n = createI18n(options) as I18n
app.use(i18n as Plugin)
app.use(i18n)
}
6 changes: 3 additions & 3 deletions src/router/index.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -552,8 +552,8 @@ export const resetRouter = (): void => {
})
}

export const setupRouter = (app: AppContext['app']) => {
app.use(router as Plugin)
export const setupRouter = (app: App<Element>) => {
app.use(router)
}

export default router
6 changes: 3 additions & 3 deletions src/store/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { AppContext, Plugin } from 'vue'
import type { App } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersist from 'pinia-plugin-persist'

const store = createPinia()

store.use(piniaPluginPersist)

export const setupStore = (app: AppContext['app']) => {
app.use(store as Plugin)
export const setupStore = (app: App<Element>) => {
app.use(store)
}

export { store }

0 comments on commit 586486a

Please sign in to comment.