Commit 2acd072 1 parent 9d73ae8 commit 2acd072 Copy full SHA for 2acd072
File tree 2 files changed +18
-10
lines changed
2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -25,28 +25,32 @@ import CountriesList from '@/Adaptcms/FieldCountry/countries.json'
25
25
26
26
export default {
27
27
props: [
28
- ' value ' ,
28
+ ' modelValue ' ,
29
29
' field' ,
30
30
' errors' ,
31
31
' formMeta' ,
32
32
' model' ,
33
33
' action'
34
34
],
35
35
36
+ emits: [
37
+ ' update:modelValue'
38
+ ],
39
+
36
40
components: {
37
41
SelectField
38
42
},
39
43
40
44
watch: {
41
- value (newVal , oldVal ) {
42
- if (newVal !== oldVal) {
45
+ modelValue (newVal , oldVal ) {
46
+ if (newVal && newVal !== oldVal) {
43
47
this .selected = newVal
44
48
}
45
49
},
46
50
47
51
selected (newVal , oldVal ) {
48
52
if (newVal !== oldVal) {
49
- this .$emit (' input ' , newVal)
53
+ this .$emit (' update:modelValue ' , newVal)
50
54
}
51
55
}
52
56
},
@@ -65,7 +69,7 @@ export default {
65
69
66
70
mounted () {
67
71
if (! this .selected ) {
68
- this .selected = this .value
72
+ this .selected = this .modelValue
69
73
}
70
74
}
71
75
}
Original file line number Diff line number Diff line change @@ -9,23 +9,27 @@ import { isEmpty } from 'lodash'
9
9
10
10
export default {
11
11
props: [
12
- ' value ' ,
12
+ ' modelValue ' ,
13
13
' field' ,
14
14
' package' ,
15
15
' errors' ,
16
16
' fields'
17
17
],
18
18
19
+ emits: [
20
+ ' update:modelValue'
21
+ ],
22
+
19
23
watch: {
20
- value (newVal , oldVal ) {
24
+ modelValue (newVal , oldVal ) {
21
25
if (newVal !== oldVal) {
22
26
this .selected = newVal
23
27
}
24
28
},
25
29
26
30
selected: {
27
31
handler : function (newVal , oldVal ) {
28
- this .$emit (' input ' , newVal)
32
+ this .$emit (' update:modelValue ' , newVal)
29
33
},
30
34
deep: true
31
35
}
@@ -38,8 +42,8 @@ export default {
38
42
},
39
43
40
44
mounted () {
41
- if (! isEmpty (this .value )) {
42
- this .selected = this .value
45
+ if (! isEmpty (this .modelValue )) {
46
+ this .selected = this .modelValue
43
47
}
44
48
}
45
49
}
You can’t perform that action at this time.
0 commit comments