Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React from 'react';
import {Form, FormItem} from 'kpc/components/form';
import {Input} from 'kpc/components/input';
import {Button} from 'kpc/components/button';
import './index.styl';
// 添加全局规则
Form.addMethod('letter', (value, item, param) => {
return /^[a-z|A-Z]+$/.test(value);
}, '只能输入字母');
export default class Demo extends React.Component {
constructor(props) {
super(props);
this.state = {
"descriptions": [
"",
""
]
};
this._onChangeValue = this._onChangeValue.bind(this);
this.add = this.add.bind(this);
this.remove = this.remove.bind(this);
}
export {default as data} from './index.json';
import Intact from 'intact';
import template from './index.vdt';
import './index.styl';
import {Form} from 'kpc/components/form';
// 添加全局规则
Form.addMethod('letter', (value, item, param) => {
return /^[a-z|A-Z]+$/.test(value);
}, '只能输入字母');
export default class extends Intact {
@Intact.template()
static template = template;
defaults() {
return {
descriptions: ['', '']
}
}
add() {
this.set('descriptions', this.get('descriptions').concat(''));
}