分割线 Divider
区隔内容的分割线。
安装
npm install antd-mobile@5.43.0
antd-mobile 是移动网页组件库,不是 React Native 或小程序组件。React 19 项目需在入口用 unstableSetRender 注册 createRoot,否则 Toast、Dialog 等命令式 API 无法渲染;深色模式通过 <html data-prefers-color-scheme="dark"> 切换。
示例来自 Ant Design Mobile 官方仓库(MIT),固定在 npm 5.43.0 对应的提交;示例中的 DemoBlock 等展示辅助组件由 JGuang 重写,不属于 antd-mobile 的 API。
区隔内容的分割线。
何时使用
- 对不同章节的文本段落进行分割。
- 对行内文字/链接进行分割,例如表格的操作列。
示例
Divider
属性
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| contentPosition | 内容位置,仅在 direction 为 horizontal 时有效 | 'center' | 'left' | 'right' | 'center' |
| direction | 水平还是垂直类型 | 'horizontal' | 'vertical' | 'horizontal' |