gpt4 book ai didi

Render components in cell using tanstack tables with Vue3(在Vue3中使用TANSTACK表呈现单元格中的组件)

转载 作者:bug小助手 更新时间:2023-10-28 09:30:54 28 4
gpt4 key购买 nike



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格式在表格单元格中呈现您的组件


更多回答

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com