Skip to content

Commit 7f2640f

Browse files
committed
Fixes bug with uncontrolled input
1 parent 92e50ba commit 7f2640f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/directive.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface AutowidthInput extends HTMLInputElement {
88
mirror: HTMLElement
99
options: Complete<InputAutoWidthOptions>
1010
windowResizeHandler?: () => void
11-
sizerFunc?: (e?: Event) => () => void
11+
sizerFunc?: (_e?: Event | undefined) => void
1212
}
1313

1414
export interface InputAutoWidthOptions {
@@ -113,7 +113,7 @@ export default {
113113
mounted: function (el: AutowidthInput, binding: DirectiveBinding, vnode: VNode) {
114114
const hasVModel = Object.prototype.hasOwnProperty.call(vnode.props, '@onUpdate:modelValue')
115115

116-
el.sizerFunc = (_e?: Event) => checkWidth.bind(null, el)
116+
el.sizerFunc = (_e?: Event) => checkWidth(el)
117117

118118
el.mirror = document.createElement('div')
119119
copyStylesToMirror(el)
@@ -134,7 +134,7 @@ export default {
134134
},
135135
updated: function (el: AutowidthInput) {
136136
if (el.sizerFunc) {
137-
el.sizerFunc()()
137+
el.sizerFunc()
138138
}
139139
},
140140
unmounted: function (el: AutowidthInput) {

0 commit comments

Comments
 (0)