Using @tanstack/vue-table, I am trying to return a component to cell(like react JSX), trying to achieve something like
使用@tanstack/vue-table,我尝试将一个组件返回给cell(如Reaction JSX),试图实现如下所示
columnHelper.accessor((row) => row.data, {
id: 'Any Id',
cell: (data) => <MyVue3Component/>
})
I have tried the FlexRender(Component, props)
but it doesn't work
我试过FlexRender(组件、道具),但不起作用
更多回答
Please trim your code to make it easier to find your problem. Follow these guidelines to create a minimal reproducible example.
请修改您的代码,以便更容易地找到您的问题。遵循这些指导原则,创建一个最小的可重现示例。
优秀答案推荐
Figured you can actually achieve this with:
我想你实际上可以通过以下方式实现这一点:
import { h} from 'vue'
columnHelper.accessor((row) => row.data, {
id: 'Status',
cell: (data) => h(MyViewComponent)
})
This will render your component in the table cell in vue-3
这将以VUE-3格式在表格单元格中呈现您的组件
更多回答
我是一名优秀的程序员,十分优秀!