UNPKG

@form-create/tdesign

Version:

tdesign动态表单|form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON. Supports 5 UI frameworks, and supports the generation of any Vue components. Built-in 20 kinds

22 lines (18 loc) 589 B
import {creatorFactory} from '@form-create/core/src/index'; const name = 'slider'; export default { name, maker: { sliderRange: creatorFactory(name, {range:true}) }, toFormValue(value, ctx) { let isArr = Array.isArray(value), props = ctx.prop.props, min = props.min || 0, parseValue; if (props.range === true) { parseValue = isArr ? value : [min, (parseFloat(value) || min)]; } else { parseValue = isArr ? (parseFloat(value[0]) || min) : parseFloat(value); } return parseValue; } }