Skip to content

Commit 2acd072

Browse files
committed
vue 3 upgrade
1 parent 9d73ae8 commit 2acd072

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

ui/field/AdminField.vue

+9-5
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,32 @@ import CountriesList from '@/Adaptcms/FieldCountry/countries.json'
2525
2626
export default {
2727
props: [
28-
'value',
28+
'modelValue',
2929
'field',
3030
'errors',
3131
'formMeta',
3232
'model',
3333
'action'
3434
],
3535
36+
emits: [
37+
'update:modelValue'
38+
],
39+
3640
components: {
3741
SelectField
3842
},
3943
4044
watch: {
41-
value (newVal, oldVal) {
42-
if (newVal !== oldVal) {
45+
modelValue (newVal, oldVal) {
46+
if (newVal && newVal !== oldVal) {
4347
this.selected = newVal
4448
}
4549
},
4650
4751
selected (newVal, oldVal) {
4852
if (newVal !== oldVal) {
49-
this.$emit('input', newVal)
53+
this.$emit('update:modelValue', newVal)
5054
}
5155
}
5256
},
@@ -65,7 +69,7 @@ export default {
6569
6670
mounted () {
6771
if (!this.selected) {
68-
this.selected = this.value
72+
this.selected = this.modelValue
6973
}
7074
}
7175
}

ui/field/AdminOptions.vue

+9-5
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,27 @@ import { isEmpty } from 'lodash'
99
1010
export default {
1111
props: [
12-
'value',
12+
'modelValue',
1313
'field',
1414
'package',
1515
'errors',
1616
'fields'
1717
],
1818
19+
emits: [
20+
'update:modelValue'
21+
],
22+
1923
watch: {
20-
value (newVal, oldVal) {
24+
modelValue (newVal, oldVal) {
2125
if (newVal !== oldVal) {
2226
this.selected = newVal
2327
}
2428
},
2529
2630
selected: {
2731
handler: function (newVal, oldVal) {
28-
this.$emit('input', newVal)
32+
this.$emit('update:modelValue', newVal)
2933
},
3034
deep: true
3135
}
@@ -38,8 +42,8 @@ export default {
3842
},
3943
4044
mounted () {
41-
if (!isEmpty(this.value)) {
42-
this.selected = this.value
45+
if (!isEmpty(this.modelValue)) {
46+
this.selected = this.modelValue
4347
}
4448
}
4549
}

0 commit comments

Comments
 (0)