Kleene. 2021-09-01 14:03 采纳率: 16.7%
浏览 36

formily中SchemaMarkupField下的type有哪些

代码是这样

<SchemaMarkupField title="昼间生产时段" name="zjshengchanks" type="dateRange" />

type类型是date的话可以选择一个时间 type="date"

img
type类型是dateRange可以选择两个事件 type="dateRange"

img
现在我需要的是时间段而不是这种相隔几天几个月的时间段,而是有选择早上几点或者下午几点这种的选择,请问type类型应该填什么,
formily官网就提供数据类型没有提供type下的选项

img
请问用过Formily的这个怎么搞

  • 写回答

1条回答 默认 最新

  • 峰子哥哥 2021-09-01 14:24
    关注
    import {
      TimePicker
    } from '@formily/antd-components' // 或者@formily/next-components
    
    const components = {
      TimePicker,
      TimeRangePicker: TimePicker.RangePicker
    }
    <SchemaForm labelCol={5} wrapperCol={14} components={components}>
          <SchemaMarkupField type="string" title="时间" name="time" x-component="TimePicker" />
    
          <SchemaMarkupField
            type="string"
            title="时间范围"
            name="timerange"
            x-component="TimeRangePicker"
          />
    </SchemaForm>
    

    以上两种可以试试看,type都为string,主要是指定x-component
    使用前记得import TimePicker
    如果能帮到你,望【采纳】

    评论

报告相同问题?

问题事件

  • 修改了问题 9月1日
  • 修改了问题 9月1日
  • 创建了问题 9月1日