CX JS - 将html插入窗口的title属性

时间:2018-06-07 07:17:02

标签: cxjs

是否可以将html内容插入CX中窗口组件的标题而不是字符串?我需要自定义窗口标题的内容。

2 个答案:

答案 0 :(得分:3)

是的。以下是如何在标题中添加其他按钮的示例:

import { Button, FlexRow, Heading, HtmlElement, Window } from "cx/widgets";

export const App = (
  <cx>
    <div>
      <Window bodyStyle="padding: 1rem">
        <FlexRow putInto="header" spacing align="center">
          <Heading level={4}>My Title</Heading>
          <div style="flex: 1" />
          <Button mod="hollow" icon="search" />
        </FlexRow>
        Window Contents
      </Window>
    </div>
  </cx>
);

https://fiddle.cxjs.io/?f=oydjHF84

答案 1 :(得分:1)

另一种选择是使用header属性。这样,您还可以在标题中创建自定义内容占位符:

    <Window
        header={(
            <cx>
                <FlexRow align="center" style="width: 100%;">
                    <span>Title</span>
                    <div style="flex: 1 1 0%" />
                    <ContentPlaceholder name="header-tools" />
                </FlexRow>
            </cx>
        )}
    >
        <LookupField 
            putInto="header-tools"
            style="width: 220px;"   
            mod="header-tool"             
            value-bind="classificationId" 
            options-bind="classifications"
        />
        Window content
    </Window>