@@ -18,12 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18
18
<template >
19
19
<v-list density =" compact" >
20
20
<v-list-item
21
- v-for =" (item, index) in modelValue "
21
+ v-for =" (item, index) in model "
22
22
:key =" index"
23
23
>
24
24
<!-- The input -->
25
25
<FormInput
26
- v-model =" modelValue [index]"
26
+ v-model =" model [index]"
27
27
:gqlType =" gqlType.ofType"
28
28
:types =" types"
29
29
ref =" inputs"
@@ -78,16 +78,20 @@ export default {
78
78
79
79
inheritAttrs: false ,
80
80
81
+ created () {
82
+ this .model ?? = []
83
+ },
84
+
81
85
methods: {
82
86
/** Add an item to the list. */
83
87
add () {
84
88
const newInput = getNullValue (this .gqlType .ofType , this .types )
85
89
let index = 0
86
90
if (this .addAtStart ) {
87
- this .modelValue .unshift (newInput)
91
+ this .model .unshift (newInput)
88
92
} else {
89
- index = this .modelValue .length
90
- this .modelValue .push (newInput)
93
+ index = this .model .length
94
+ this .model .push (newInput)
91
95
}
92
96
// this is not ideal, but I believe whats happening is the new (wrapper) component is created over the first tick from the new array item
93
97
// the component content is created over the next tick (including the input)
@@ -101,7 +105,7 @@ export default {
101
105
102
106
/** Remove the item at `index` from the list. */
103
107
remove (index ) {
104
- this .modelValue .splice (index, 1 )
108
+ this .model .splice (index, 1 )
105
109
}
106
110
},
107
111
0 commit comments