| title | 
nav | 
group | 
| InputNumber - 数字框 | 
 | 
| order | 
title | 
path | 
 
| 1 | 
Schemas | 
/client/schemas | 
 
 
 | 
InputNumber - 数字框
Node Tree
Designable Bar
- InputNumber.DesignableBar
 
Examples
数字框
/**
 * title: 数字框
 */
import React from 'react';
import { SchemaRenderer } from '../';
const schema = {
  type: 'object',
  properties: {
    input: {
      type: 'number',
      title: `编辑模式`,
      'x-decorator': 'FormItem',
      'x-component': 'InputNumber',
      'x-reactions': {
        target: 'read',
        fulfill: {
          state: {
            value: '{{$self.value}}',
          },
        },
      },
    },
    read: {
      interface: 'number',
      type: 'number',
      title: `阅读模式`,
      'x-read-pretty': true,
      'x-decorator': 'FormItem',
      'x-component': 'InputNumber',
    },
  }
};
export default () => {
  return (
    <SchemaRenderer schema={schema} />
  );
};
百分比
/**
 * title: 百分比
 */
import React from 'react';
import { SchemaRenderer } from '../';
const schema = {
  type: 'object',
  properties: {
    input: {
      type: 'number',
      title: `编辑模式`,
      'x-decorator': 'FormItem',
      'x-component': 'InputNumber',
      'x-component-props': {
        placeholder: 'please enter',
        addonAfter: '%',
      },
      'x-reactions': {
        target: 'read',
        fulfill: {
          state: {
            value: '{{$self.value}}',
          },
        },
      },
    },
    read: {
      type: 'number',
      title: `阅读模式`,
      'x-read-pretty': true,
      'x-decorator': 'FormItem',
      'x-component': 'InputNumber',
      'x-component-props': {
        placeholder: 'please enter',
        addonAfter: '%',
      },
    },
  }
};
export default () => {
  return (
    <SchemaRenderer schema={schema} />
  );
};
精度
/**
 * title: 精度
 */
import React from 'react';
import { SchemaRenderer } from '../';
const schema = {
  type: 'object',
  properties: {
    input: {
      type: 'number',
      title: `编辑模式`,
      'x-decorator': 'FormItem',
      'x-component': 'InputNumber',
      'x-component-props': {
        placeholder: 'please enter',
        stringMode: true,
        step: '0.001',
      },
      'x-reactions': {
        target: 'read',
        fulfill: {
          state: {
            value: '{{$self.value}}',
          },
        },
      },
    },
    read: {
      type: 'number',
      title: `阅读模式`,
      'x-read-pretty': true,
      'x-decorator': 'FormItem',
      'x-component': 'InputNumber',
      'x-component-props': {
        placeholder: 'please enter',
        stringMode: true,
        step: '0.001',
      },
    },
  }
};
export default () => {
  return (
    <SchemaRenderer schema={schema} />
  );
};
addonBefore 和 addonAfter 支持
import React from 'react';
import { SchemaRenderer } from '../';
const schema = {
  type: 'object',
  properties: {
    input: {
      type: 'number',
      title: `数字`,
      'x-component': 'InputNumber',
      'x-component-props': {
        placeholder: 'please enter',
        addonBefore: '前缀',
        addonAfter: '后缀',
      },
    },
  }
};
export default () => {
  return (
    <SchemaRenderer schema={schema} />
  );
};