|
1 | 1 | /**
|
2 |
| - * vue-autonumeric v1.2.4 (https://github.com/autoNumeric/vue-autoNumeric) |
| 2 | + * vue-autonumeric v1.2.5 (https://github.com/autoNumeric/vue-autoNumeric) |
3 | 3 | * © 2018 Alexandre Bonneau <[email protected]>
|
4 | 4 | * Released under the MIT License.
|
5 | 5 | */
|
@@ -328,7 +328,7 @@ exports.default = {
|
328 | 328 | };
|
329 | 329 | } else {
|
330 | 330 | attributes = {
|
331 |
| - contenteditable: true |
| 331 | + contenteditable: this.hasContentEditable |
332 | 332 | };
|
333 | 333 | }
|
334 | 334 |
|
@@ -378,26 +378,29 @@ exports.default = {
|
378 | 378 |
|
379 | 379 | data: function data() {
|
380 | 380 | return {
|
381 |
| - anElement: null |
382 |
| - }; |
| 381 | + anElement: null, |
| 382 | + initialOptions: null, |
| 383 | + hasContentEditable: true }; |
383 | 384 | },
|
384 |
| - mounted: function mounted() { |
| 385 | + created: function created() { |
385 | 386 | var _this = this;
|
386 | 387 |
|
387 |
| - var options = void 0; |
388 | 388 | if (Array.isArray(this.options)) {
|
389 | 389 | var optionObjects = {};
|
390 | 390 | this.options.forEach(function (optionElement) {
|
391 |
| - options = _this.manageOptionElement(optionElement); |
392 |
| - optionObjects = (0, _assign2.default)(optionObjects, options); |
| 391 | + _this.initialOptions = _this.manageOptionElement(optionElement); |
| 392 | + optionObjects = (0, _assign2.default)(optionObjects, _this.initialOptions); |
393 | 393 | });
|
394 | 394 |
|
395 |
| - options = optionObjects; |
| 395 | + this.initialOptions = optionObjects; |
396 | 396 | } else {
|
397 |
| - options = this.manageOptionElement(this.options); |
| 397 | + this.initialOptions = this.manageOptionElement(this.options); |
398 | 398 | }
|
399 | 399 |
|
400 |
| - this.anElement = new _autoNumeric2.default(this.$refs.autoNumericElement, options); |
| 400 | + this.hasContentEditable = !this.initialOptions.readOnly; |
| 401 | + }, |
| 402 | + mounted: function mounted() { |
| 403 | + this.anElement = new _autoNumeric2.default(this.$refs.autoNumericElement, this.initialOptions); |
401 | 404 | if (this.value !== null && this.value !== '') {
|
402 | 405 | this.anElement.set(this.value);
|
403 | 406 |
|
|
0 commit comments