Skip to content
This repository was archived by the owner on Sep 4, 2024. It is now read-only.

Commit e0d102f

Browse files
author
Max Lyashuk
committed
fix(directive): reformat despite the same value
1 parent dd7fffe commit e0d102f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/directive.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ import { isAndroid, isChrome } from './utils/env';
99
* @param {Boolean} force
1010
*/
1111
function updateValue(el, force = false) {
12-
const { value, dataset: { previousValue = '', mask } } = el;
12+
const { value = '', dataset: { mask } } = el;
1313

14-
if (force || (value && value !== previousValue && value.length > previousValue.length)) {
14+
const hasValue = value.trim().length > 0;
15+
16+
if (force || hasValue) {
1517
el.value = format(value, mask);
1618
if (isAndroid && isChrome) {
1719
setTimeout(() => trigger(el, 'input'), 0);
1820
} else {
1921
trigger(el, 'input');
2022
}
2123
}
22-
23-
el.dataset.previousValue = value;
2424
}
2525

2626
/**

0 commit comments

Comments
 (0)