描述

插入分隔符。

  • 分隔符即可独占一行,也可像普通内容一样依次布局
  • 结合段落行距设置,可以实现更多显示效果

接口

bool InsertSeparator(float width, float height, const char* json_cfg)

参数

参数名 必填 类型 说明 备注
width float 宽度 单位:cm 为0时宽度自适应父级容器宽度
height float 高度 单位:cm 表示对象高度,影响行高布局

Json参数

参数名 必填 类型 说明 备注
color long long 线条颜色 默认黑色 RGB 示例红色:”ff0000”或 0xff0000
style int 线形 0:默认 实线; 1:实线; 2:虚线 ——-; 3:虚线 …….;
lineWidth float 线条宽度 单位:cm 默认为0.02cm。=0时,不显示线,可作为间隔符使用
alignVerticalLayout int 垂直布局方式 E_ALIGN_VERTICAL_LAYOUT
independentLine int 是否独立一行 0:非单独一行 1:单独一行

返回值

类型 说明 备注
bool 插入是否成功 1:成功 0:失败

示例

作为同行连接符使用

代码

let cfg = {};
cfg.alignVerticalLayout = E_LAYOUT_VERTICAL_ALIGN::SelfMiddle;
cfg.independentLine = false;
cfg.color = COLOR_RED;
thinkEditor.InsertSeparator(3, 0.04, cfg);

效果

作为空间分隔符使用

代码

let cfg = {};
cfg.independentLine = true;
cfg.color = COLOR_RED;
thinkEditor.InsertSeparator(3, 0.04, cfg);

效果

自动占满父级宽度

代码

let cfg = {};
cfg.independentLine = true;
cfg.color = COLOR_RED;
thinkEditor.InsertSeparator(0, 0.04, cfg);

效果

独立段落

代码

let cfg = {};
cfg.alignVerticalLayout = E_LAYOUT_VERTICAL_ALIGN::SelfMiddle;
cfg.independentLine = true;
cfg.color = COLOR_RED;
thinkEditor.InsertSeparator(0, 0.04, cfg);

效果

文档更新时间: 2025-04-25 14:33   作者:admin