Skip to content
On this page

vue中声明组件的方式

函数式组件使用

ts
// 组件申明
import { FunctionalComponent } from 'vue'

export const CellComponent: FunctionalComponent = (
    props, {}
) => {
    return h('span', {
        text: '123',
    }, {
        default: () => '我是默认内容',
    })
}


// 组件使用
<CellComponent>
    <template #header>
        我是插槽内容
    </template>
</CellComponent>