index.js 825 B

123456789101112131415161718192021222324
  1. import { ElSlider } from 'element-plus'
  2. import { useFormInput } from '@cip/components/hooks/form-input'
  3. import { formInputProps, fromInputEmits } from '../../form-input-props'
  4. import { useSliderConfig } from './use-slider-config'
  5. import './index.less'
  6. export default {
  7. props: formInputProps,
  8. emits: [...fromInputEmits],
  9. setup (props, context) {
  10. const formInput = useFormInput(props, context)
  11. const { proxyValue, width } = formInput
  12. const { max, min, step } = useSliderConfig(formInput)
  13. return () => <div class={'basic-slider'} style={{ width: width.value }}>
  14. <ElSlider
  15. v-model={proxyValue.value}
  16. max={max.value}
  17. min={min.value}
  18. step={step.value}
  19. disabled={props.disabled}
  20. marks={props.config.marks}
  21. />
  22. </div>
  23. }
  24. }