Skip to content

Commit a471910

Browse files
Fix issue #9 Modifying the options will always lose the decimal places precision after 2 places
Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>
1 parent a60a48c commit a471910

File tree

6 files changed

+35
-7
lines changed

6 files changed

+35
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Changelog for vue-autoNumeric
22

3+
### 1.0.7
4+
+ Fix issue #9 Modifying the `options` will always lose the decimal places precision after `2` places
5+
+ This happens since `resetOnOptions` temporarily resets the configuration to the default one, which set the `decimalPlaces` option to `2`.
6+
37
### 1.0.6
48
+ Fix issue #8 Add a new `resetOnOptions` props so that updating the `options` one first reset to the default options
59
+ Add a `resetOnOptions` props set the `true` by default so that updating the `options` prop first call `.options.reset()`

dist/vue-autonumeric.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-autonumeric v1.0.6 (https://github.com/autoNumeric/vue-autoNumeric)
2+
* vue-autonumeric v1.0.7 (https://github.com/autoNumeric/vue-autoNumeric)
33
* © 2018 Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>
44
* Released under the MIT License.
55
*/
@@ -438,7 +438,10 @@ exports.default = {
438438
options: function options(newValue, oldValue) {
439439
if ((0, _stringify2.default)(newValue) !== (0, _stringify2.default)(oldValue)) {
440440
if (this.resetOnOptions) {
441-
this.anElement.options.reset();
441+
var decimalPlacesRawValue = this.anElement.getSettings().decimalPlacesRawValue;
442+
var optionsToReset = (0, _assign2.default)({}, _AutoNumeric2.default.getDefaultConfig(), { decimalPlacesRawValue: decimalPlacesRawValue });
443+
444+
this.anElement.update(optionsToReset);
442445
}
443446

444447
this.anElement.update(newValue);

0 commit comments

Comments
 (0)