Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit d26732f

Browse files
committed
updated default handling
1 parent d13becd commit d26732f

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

dist/vue-form.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,15 +333,18 @@ return /******/ (function(modules) { // webpackBootstrap
333333
created: function () {
334334
this.$set('key', '["' + this.name.replace(/\./g, '"]["') + '"]');
335335
this.attrs.class = this.attrs.class || this.class;
336+
337+
if (_.isUndefined(this.value) && !_.isUndefined(this.default)) {
338+
this.value = this.default;
339+
}
336340
},
337341

338342
computed: {
339343

340344
value: {
341345

342346
get: function () {
343-
var value = this.$get('values' + this.key);
344-
return _.isUndefined(value) ? this.default : value;
347+
return this.$get('values' + this.key);
345348
},
346349

347350
set: function (value) {

dist/vue-form.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/field.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@ module.exports = function (_, types) {
2323
created: function () {
2424
this.$set('key', '["' + this.name.replace(/\./g, '"]["') + '"]');
2525
this.attrs.class = this.attrs.class || this.class;
26+
27+
if (_.isUndefined(this.value) && !_.isUndefined(this.default)) {
28+
this.value = this.default;
29+
}
2630
},
2731

2832
computed: {
2933

3034
value: {
3135

3236
get: function () {
33-
var value = this.$get('values' + this.key);
34-
return _.isUndefined(value) ? this.default : value;
37+
return this.$get('values' + this.key);
3538
},
3639

3740
set: function (value) {

0 commit comments

Comments
 (0)