mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-19 17:00:53 +08:00
Fix input demo tooltip
This commit is contained in:
parent
f5b0536d42
commit
173b8c46ad
@ -405,15 +405,11 @@ exports[`test renders ./components/input/demo/textarea.md correctly 1`] = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`test renders ./components/input/demo/tooltip.md correctly 1`] = `
|
exports[`test renders ./components/input/demo/tooltip.md correctly 1`] = `
|
||||||
<div
|
<input
|
||||||
class="numeric-input-demo">
|
class="ant-input"
|
||||||
<div>
|
maxlength="25"
|
||||||
<input
|
placeholder="Input a number"
|
||||||
class="ant-input"
|
style="width:120px;"
|
||||||
maxlength="25"
|
type="text"
|
||||||
placeholder="input a number"
|
value="" />
|
||||||
type="text"
|
|
||||||
value="" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
`;
|
||||||
|
@ -40,7 +40,6 @@ class NumericInput extends React.Component {
|
|||||||
this.props.onChange(value);
|
this.props.onChange(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// '.' at the end or only '-' in the input box.
|
// '.' at the end or only '-' in the input box.
|
||||||
onBlur = () => {
|
onBlur = () => {
|
||||||
const { value, onBlur, onChange } = this.props;
|
const { value, onBlur, onChange } = this.props;
|
||||||
@ -51,14 +50,13 @@ class NumericInput extends React.Component {
|
|||||||
onBlur();
|
onBlur();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { value } = this.props;
|
const { value } = this.props;
|
||||||
const title = value ? (
|
const title = value ? (
|
||||||
<span className="numeric-input-title">
|
<span className="numeric-input-title">
|
||||||
{value !== '-' ? formatNumber(value) : '-'}
|
{value !== '-' ? formatNumber(value) : '-'}
|
||||||
</span>
|
</span>
|
||||||
) : '';
|
) : 'Input a number';
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
trigger={['focus']}
|
trigger={['focus']}
|
||||||
@ -70,7 +68,7 @@ class NumericInput extends React.Component {
|
|||||||
{...this.props}
|
{...this.props}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
onBlur={this.onBlur}
|
onBlur={this.onBlur}
|
||||||
placeholder="input a number"
|
placeholder="Input a number"
|
||||||
maxLength="25"
|
maxLength="25"
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@ -87,8 +85,7 @@ class NumericInputDemo extends React.Component {
|
|||||||
this.setState({ value });
|
this.setState({ value });
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
const { value } = this.state;
|
return <NumericInput style={{ width: 120 }} value={this.state.value} onChange={this.onChange} />;
|
||||||
return <NumericInput style={{ width: 120 }} value={value} onChange={this.onChange} />;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user