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'
export const areas: FreshLayoutItem = {
name: 'areas',
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'
export const blackboard: FreshLayoutItem = {
name: 'blackboard',
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 { FreshLayoutItem } from '../fresh-layout-item'
@ -15,5 +16,5 @@ export const categories: FreshLayoutItem = {
name: 'categories',
displayName: '分区',
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'
export const feeds: FreshLayoutItem = {
name: 'feeds',
displayName: '动态',
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 {
component: Executable<ImportedVueComponent>
component: Component
grow?: boolean
}
export interface FreshLayoutItemSettings {

View File

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