docs: update demo, close: #1872

This commit is contained in:
Benjy Cui 2016-07-25 16:08:18 +08:00
parent 408027b95d
commit 11660c128b

View File

@ -20,6 +20,7 @@ function noop() {
let Demo = React.createClass({ let Demo = React.createClass({
getInitialState() { getInitialState() {
return { return {
dirty: false,
passBarShow: false, // 是否显示密码强度提示条 passBarShow: false, // 是否显示密码强度提示条
rePassBarShow: false, rePassBarShow: false,
passStrength: 'L', // 密码强度 passStrength: 'L', // 密码强度
@ -67,7 +68,7 @@ let Demo = React.createClass({
const form = this.props.form; const form = this.props.form;
this.getPassStrenth(value, 'pass'); this.getPassStrenth(value, 'pass');
if (form.getFieldValue('pass')) { if (form.getFieldValue('pass') && this.state.dirty) {
form.validateFields(['rePass'], { force: true }); form.validateFields(['rePass'], { force: true });
} }
@ -150,6 +151,10 @@ let Demo = React.createClass({
<Input {...passProps} type="password" <Input {...passProps} type="password"
onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop} onContextMenu={noop} onPaste={noop} onCopy={noop} onCut={noop}
autoComplete="off" id="pass" autoComplete="off" id="pass"
onBlur={(e) => {
const value = e.target.value;
this.setState({ dirty: this.state.dirty || !!value });
}}
/> />
</FormItem> </FormItem>
</Col> </Col>