Skip to content

Commit 5016046

Browse files
author
Dipak Sarkar
committed
updated some core functions
1 parent 2c0c623 commit 5016046

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Vue Number Format is used to format a number using fixed-point notation. It can be used to format a number with a specific number of digits to the right of the decimal.
77
## Features
88

9-
- Lightweight < 2kb
9+
- Lightweight
1010
- Dependency free
1111
- Smooth migration
1212
- Component or Directive flavour

src/core.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,9 @@ export function getInputElement(el) {
5353
*/
5454
export function updateCursor(el, position) {
5555
const setSelectionRange = () => { el.setSelectionRange(position, position) }
56-
if (el === document.activeElement) {
57-
setSelectionRange()
58-
// Android Fix
59-
setTimeout(setSelectionRange, 1)
60-
}
56+
setSelectionRange()
57+
// Android Fix
58+
setTimeout(setSelectionRange(), 0)
6159
}
6260

6361
/**

src/directive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default {
3030
// check decimal key and insert to current element
3131
// updated cursor position after format the value
3232
el.onkeydown = (e) => {
33-
if (e.key === '.' || e.key === config.decimal) {
33+
if ([110, 190].includes(e.keyCode) || e.key === config.decimal) {
3434
e.preventDefault()
3535
el.setRangeText(config.decimal)
3636
el.dispatchEvent(new Event('input'))

0 commit comments

Comments
 (0)