index.js 451 Bytes
Newer Older
1
import React, { useEffect } from 'react'
2 3
import { InputNumber } from 'antd'

4 5 6
const AutoCalculate = (props) => {

  const { value, onChange, schema, addons } = props
7 8 9 10 11
  const { disabled, presetValue } = schema

  useEffect(() => {
    onChange(presetValue)
  }, [presetValue])
12 13

  return (
14
    <InputNumber
15
      value={Number(value)}
16 17 18 19
      style={{ width: '100%' }}
      disabled={disabled}
    >
    </InputNumber>
20 21 22 23 24
  )

}

export default AutoCalculate