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

Commit 0f8af90

Browse files
committed
update default value handling
1 parent c905133 commit 0f8af90

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/field.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ export default {
3333
value: {
3434

3535
get() {
36-
return get(this.values, this.name);
36+
37+
const value = get(this.values, this.name);
38+
39+
if (isUndefined(value) && !isUndefined(this.default)) {
40+
return this.value = this.default;
41+
}
42+
43+
return value;
3744
},
3845

3946
set(value) {
@@ -57,14 +64,6 @@ export default {
5764

5865
},
5966

60-
created() {
61-
62-
if (isUndefined(this.value) && !isUndefined(this.default)) {
63-
this.value = this.default;
64-
}
65-
66-
},
67-
6867
methods: {
6968

7069
filterOptions(options) {

0 commit comments

Comments
 (0)