fix: input & textarea autofocus
parent
6cad9c3cc0
commit
ad371c20b6
|
@ -1 +1 @@
|
|||
Subproject commit 44f59845e9fa34578b79066f22fb14526f4ee7a6
|
||||
Subproject commit dbe3af5b20e6599a78a9a7fba7c13258b36646a7
|
|
@ -1,5 +1,7 @@
|
|||
# break change
|
||||
|
||||
## global api
|
||||
|
||||
## Tag
|
||||
|
||||
### CheckableTag
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
export default function syncWatch(fn) {
|
||||
return {
|
||||
handler: fn,
|
||||
flush: 'sync',
|
||||
};
|
||||
}
|
|
@ -5,6 +5,7 @@ import inputProps from './inputProps';
|
|||
import { hasProp, getComponent, getOptionProps } from '../_util/props-util';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
import ClearableLabeledInput from './ClearableLabeledInput';
|
||||
import syncWatch from '../_util/syncWatch';
|
||||
|
||||
function noop() {}
|
||||
|
||||
|
@ -68,15 +69,12 @@ export default {
|
|||
};
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
value: syncWatch(function(val) {
|
||||
this.stateValue = val;
|
||||
},
|
||||
}),
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
if (this.autoFocus) {
|
||||
this.focus();
|
||||
}
|
||||
this.clearPasswordValueAttribute();
|
||||
});
|
||||
},
|
||||
|
@ -142,7 +140,6 @@ export default {
|
|||
'size',
|
||||
'inputType',
|
||||
'className',
|
||||
'autoFocus',
|
||||
'inputPrefixCls',
|
||||
'loading',
|
||||
]);
|
||||
|
@ -164,6 +161,9 @@ export default {
|
|||
if (inputProps.maxLength === undefined) {
|
||||
delete inputProps.maxLength;
|
||||
}
|
||||
if (!inputProps.autoFocus) {
|
||||
delete inputProps.autoFocus;
|
||||
}
|
||||
return <input {...inputProps} />;
|
||||
},
|
||||
clearPasswordValueAttribute() {
|
||||
|
|
|
@ -136,12 +136,15 @@ const ResizableTextArea = {
|
|||
...otherProps,
|
||||
style,
|
||||
class: cls,
|
||||
directives: [
|
||||
{
|
||||
name: 'ant-input',
|
||||
},
|
||||
],
|
||||
// directives: [
|
||||
// {
|
||||
// name: 'ant-input',
|
||||
// },
|
||||
// ],
|
||||
};
|
||||
if (!textareaProps.autoFocus) {
|
||||
delete textareaProps.autoFocus;
|
||||
}
|
||||
return (
|
||||
<ResizeObserver onResize={this.handleResize} disabled={!(autoSize || autosize)}>
|
||||
<textarea {...textareaProps} ref={this.saveTextArea} />
|
||||
|
|
|
@ -6,6 +6,7 @@ import { hasProp, getOptionProps } from '../_util/props-util';
|
|||
import { ConfigConsumerProps } from '../config-provider';
|
||||
import { fixControlledValue, resolveOnChange } from './Input';
|
||||
import PropTypes from '../_util/vue-types';
|
||||
import syncWatch from '../_util/syncWatch';
|
||||
|
||||
const TextAreaProps = {
|
||||
...inputProps,
|
||||
|
@ -32,16 +33,9 @@ export default {
|
|||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
value(val) {
|
||||
value: syncWatch(function(val) {
|
||||
this.stateValue = val;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
if (this.autoFocus) {
|
||||
this.focus();
|
||||
}
|
||||
});
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
setValue(value, callback) {
|
||||
|
|
Loading…
Reference in New Issue