import '../assets/index.less'; import TreeSelect from '../index'; import Select from '../../vc-select'; import { createForm } from '../../vc-form'; import { regionStyle, errorStyle } from './styles'; import { gData } from './util'; import '../../vc-select/assets/index.less'; import './demo.less'; const { Option } = Select; const TreeSelectInput = { props: ['multiple', 'treeData', 'treeCheckable', 'value'], methods: { onChange(value) { console.log(value, arguments); this.$emit('change', value); }, }, render() { return ; }, }; const Form = { methods: { onSubmit(e) { console.log('submit'); e.preventDefault(); this.form.validateFields((error, values) => { if (!error) { console.log('ok', values); } else { console.log('error', error, values); } }); }, reset(e) { e.preventDefault(); this.form.resetFields(); }, }, render() { const { form } = this; const { getFieldDecorator, getFieldError } = form; const tProps = { props: { multiple: true, treeData: gData, treeCheckable: true, __propsSymbol__: Symbol(), // treeDefaultExpandAll: true, }, }; return (

validity

no onChange

{getFieldDecorator('tree-select', { initialValue: ['0-0-0-value'], rules: [{ required: true, type: 'array', message: 'tree-select 需要必填' }], })()}

{getFieldError('tree-select') ? getFieldError('tree-select').join(',') : null}

custom onChange

{getFieldDecorator('tree-select1', { initialValue: ['0-0-0-value'], rules: [{ required: true, type: 'array', message: 'tree-select1 需要必填' }], })( , )}

{getFieldError('tree-select1') ? getFieldError('tree-select1').join(',') : null}

{getFieldDecorator('select', { initialValue: ['jack'], rules: [{ required: true, type: 'array', message: 'select 需要必填' }], })( , )}

{getFieldError('select') ? getFieldError('select').join(',') : null}

 
); }, }; export default createForm()(Form);