Use type Component as vue component in FreshLayoutItem

This commit is contained in:
timongh 2023-02-09 13:38:47 +08:00
parent 8c306f37db
commit cd1410f9bb
6 changed files with 13 additions and 7 deletions

View File

@ -1,7 +1,8 @@
import { defineAsyncComponent } from 'vue'
import type { FreshLayoutItem } from '../fresh-layout-item' import type { FreshLayoutItem } from '../fresh-layout-item'
export const areas: FreshLayoutItem = { export const areas: FreshLayoutItem = {
name: 'areas', name: 'areas',
displayName: '栏目', displayName: '栏目',
component: () => import('./Areas.vue').then(m => m.default), component: defineAsyncComponent(() => import('./Areas.vue')),
} }

View File

@ -1,7 +1,8 @@
import { defineAsyncComponent } from 'vue'
import type { FreshLayoutItem } from '../fresh-layout-item' import type { FreshLayoutItem } from '../fresh-layout-item'
export const blackboard: FreshLayoutItem = { export const blackboard: FreshLayoutItem = {
name: 'blackboard', name: 'blackboard',
displayName: '活动', displayName: '活动',
component: () => import('./Blackboard.vue').then(m => m.default), component: defineAsyncComponent(() => import('./Blackboard.vue')),
} }

View File

@ -1,3 +1,4 @@
import { defineAsyncComponent } from 'vue'
import type { Category } from '@/components/utils/categories/data' import type { Category } from '@/components/utils/categories/data'
import type { FreshLayoutItem } from '../fresh-layout-item' import type { FreshLayoutItem } from '../fresh-layout-item'
@ -15,5 +16,5 @@ export const categories: FreshLayoutItem = {
name: 'categories', name: 'categories',
displayName: '分区', displayName: '分区',
grow: true, grow: true,
component: () => import('./Categories.vue').then(m => m.default), component: defineAsyncComponent(() => import('./Categories.vue')),
} }

View File

@ -1,8 +1,9 @@
import { defineAsyncComponent } from 'vue'
import type { FreshLayoutItem } from '../fresh-layout-item' import type { FreshLayoutItem } from '../fresh-layout-item'
export const feeds: FreshLayoutItem = { export const feeds: FreshLayoutItem = {
name: 'feeds', name: 'feeds',
displayName: '动态', displayName: '动态',
grow: true, grow: true,
component: () => import('./Feeds.vue').then(m => m.default), component: defineAsyncComponent(() => import('./Feeds.vue')),
} }

View File

@ -1,7 +1,8 @@
import type { Executable, ImportedVueComponent, WithName } from '@/core/common-types' import type { Component } from 'vue'
import type { WithName } from '@/core/common-types'
export interface FreshLayoutItem extends WithName { export interface FreshLayoutItem extends WithName {
component: Executable<ImportedVueComponent> component: Component
grow?: boolean grow?: boolean
} }
export interface FreshLayoutItemSettings { export interface FreshLayoutItemSettings {

View File

@ -1,8 +1,9 @@
import { defineAsyncComponent } from 'vue'
import type { FreshLayoutItem } from '../fresh-layout-item' import type { FreshLayoutItem } from '../fresh-layout-item'
export const trending: FreshLayoutItem = { export const trending: FreshLayoutItem = {
name: 'trending', name: 'trending',
displayName: '热门视频', displayName: '热门视频',
grow: true, grow: true,
component: () => import('./Trending.vue').then(m => m.default), component: defineAsyncComponent(() => import('./Trending.vue')),
} }