import { Slider as VanSlider, Toast } from 'vant'
import { useFormInput } from '../../../hooks/form-input'
import { formInputProps } from '../../form-input-props'
import './index.less'
export default {
  props: formInputProps,
  setup (props, context) {
    const { proxyValue, width } = useFormInput(props, context)
    const handleChange = (value) => {
      Toast('当前值：' + value)
    }
    return () => <div class={'basic-slider--m__wrapper'}>
      <div class={'basic-slider--m'} style={{ width: width.value }}>
        <VanSlider
          style={{ width: '100%', top: '50%', transform: 'translateY(-50%)' }}
          v-model={proxyValue.value}
          min={props.config?.min}
          max={props.config?.max}
          step={props.config?.step}
          onChange={handleChange}
        />
      </div>
    </div>
  }
}
