@form-create/iview
Version:
iview动态表单|form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON. Supports 3 UI frameworks, and supports the generation of any Vue components. Built-in 20 kinds o
21 lines (18 loc) • 588 B
JavaScript
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;
}
}