小编Gau*_*rma的帖子

如何在命令栏中渲染自定义组件(UI Fabric)

我尝试了很多方法来在命令栏组件中渲染自定义组件,但没有成功。让我知道命令栏组件的可能性或局限性。

import { CommandBar } from 'office-ui-fabric-react/lib/CommandBar';
const items: ICommandBarItemProps[] = [{
        key: "topicName",
        text: displayTitle,
        disabled: true,
        buttonStyles: {
            textContainer: {
                color: colorBlack
            },
            label: {
                fontWeight: "bold"
            },
            rootDisabled: {
                backgroundColor: colorWhite
            }
        },
    },
    // in here i want to render custom component (just after topicName)
]; 
<CommandBar items = {items}
farItems = {farItems} />
Run Code Online (Sandbox Code Playgroud)

我也尝试过这种方式,但出现错误。

{ key: 'custom', onRender: (item: any) => <div>Custom</div> }

typescript reactjs office-ui-fabric

1
推荐指数
1
解决办法
3988
查看次数

标签 统计

office-ui-fabric ×1

reactjs ×1

typescript ×1