Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
15d528c7
Commit
15d528c7
authored
Jan 09, 2018
by
Jiewei Qian
Committed by
baiyaaaaa
Jan 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input-number: fix user input parsing (#9166)
parent
837354df
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
4 additions
and
31 deletions
+4
-31
examples/docs/en-US/input-number.md
examples/docs/en-US/input-number.md
+0
-1
examples/docs/es/input-number.md
examples/docs/es/input-number.md
+0
-1
examples/docs/zh-CN/input-number.md
examples/docs/zh-CN/input-number.md
+0
-1
packages/input-number/src/input-number.vue
packages/input-number/src/input-number.vue
+3
-27
test/unit/specs/input-number.spec.js
test/unit/specs/input-number.spec.js
+1
-1
No files found.
examples/docs/en-US/input-number.md
View file @
15d528c7
...
...
@@ -162,7 +162,6 @@ Use attribute `size` to set additional sizes with `medium`, `small` or `mini`.
|size | size of the component | string | large/small| — |
|disabled| whether the component is disabled | boolean | — | false |
|controls| whether to enable the control buttons | boolean | — | true |
|debounce| debounce delay when typing, in milliseconds | number | — | 300 |
|controls-position | position of the control buttons | string | right | - |
|name | same as
`name`
in native input | string | — | — |
|label | label text | string | — | — |
...
...
examples/docs/es/input-number.md
View file @
15d528c7
...
...
@@ -163,7 +163,6 @@ Utilice el atributo `size` para establecer tamaños adicionales con `medium`, `s
| size | tamaño del componente | string | large/small | — |
| disabled | si el componente esta deshabilitado | boolean | — | false |
| controls | si se activan los botones de control | boolean | — | true |
| debounce | retardo de rebote al escribir, en milisegundos | number | — | 300 |
| controls-position | posición de los botones de control | string | right | - |
| name | lo mismo que
`name`
en un input nativo | string | — | — |
| label | texto de la etiqueta | string | — | — |
...
...
examples/docs/zh-CN/input-number.md
View file @
15d528c7
...
...
@@ -159,7 +159,6 @@
| size | 计数器尺寸 | string | large, small | — |
| disabled | 是否禁用计数器 | boolean | — | false |
| controls | 是否使用控制按钮 | boolean | — | true |
| debounce | 输入时的去抖延迟,毫秒 | number | — | 300 |
| controls-position | 控制按钮位置 | string | right | - |
| name | 原生属性 | string | — | — |
| label | 输入框关联的label文字 | string | — | — |
...
...
packages/input-number/src/input-number.vue
View file @
15d528c7
...
...
@@ -33,7 +33,7 @@
@
keydown.down.native.prevent=
"decrease"
@
blur=
"handleBlur"
@
focus=
"handleFocus"
@
input=
"debounceHandleInput
"
@
change=
"handleInputChange
"
:disabled=
"disabled"
:size=
"inputNumberSize"
:max=
"max"
...
...
@@ -53,7 +53,6 @@
</template>
<
script
>
import
ElInput
from
'
element-ui/packages/input
'
;
import
debounce
from
'
throttle-debounce/debounce
'
;
import
Focus
from
'
element-ui/src/mixins/focus
'
;
import
RepeatClick
from
'
element-ui/src/directives/repeat-click
'
;
...
...
@@ -97,10 +96,6 @@
type
:
String
,
default
:
''
},
debounce
:
{
type
:
Number
,
default
:
300
},
name
:
String
,
label
:
String
},
...
...
@@ -204,32 +199,13 @@
this
.
$emit
(
'
input
'
,
newVal
);
this
.
currentValue
=
newVal
;
},
handleInput
(
value
)
{
if
(
value
===
''
)
{
return
;
}
if
(
value
.
indexOf
(
'
.
'
)
===
(
value
.
length
-
1
))
{
return
;
}
if
(
value
.
indexOf
(
'
-
'
)
===
(
value
.
length
-
1
))
{
return
;
}
handleInputChange
(
value
)
{
const
newVal
=
Number
(
value
);
if
(
!
isNaN
(
newVal
))
{
this
.
setCurrentValue
(
newVal
);
}
else
{
this
.
$refs
.
input
.
setCurrentValue
(
this
.
currentValue
);
}
}
},
created
()
{
this
.
debounceHandleInput
=
debounce
(
this
.
debounce
,
value
=>
{
this
.
handleInput
(
value
);
});
},
mounted
()
{
let
innerInput
=
this
.
$refs
.
input
.
$refs
.
input
;
innerInput
.
setAttribute
(
'
role
'
,
'
spinbutton
'
);
...
...
test/unit/specs/input-number.spec.js
View file @
15d528c7
...
...
@@ -285,7 +285,7 @@ describe('InputNumber', () => {
});
it
(
'
emit on input
'
,
done
=>
{
vm
.
$refs
.
compo
.
handleInput
(
'
3
'
);
vm
.
$refs
.
compo
.
handleInput
Change
(
'
3
'
);
setTimeout
(
_
=>
{
expect
(
spy
.
calledOnce
).
to
.
be
.
true
;
expect
(
spy
.
args
[
0
][
0
]).
to
.
equal
(
3
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment