|
22 | 22 | :hint="v.description" |
23 | 23 | v-model="editedEnvironment[v.name]" |
24 | 24 | :required="v.required" |
25 | | - :rules="[(val) => !v.required || val != null || v.title + ' ' + $t('isRequired')]" |
| 25 | + :rules="[ |
| 26 | + (val) => !v.required || val != null || v.title + ' ' + $t('isRequired'), |
| 27 | + ]" |
26 | 28 | :items="v.values" |
27 | 29 | item-text="name" |
28 | 30 | item-value="value" |
|
32 | 34 | dense |
33 | 35 | > |
34 | 36 | <template v-slot:selection="{ item, index }"> |
35 | | - <v-chip v-if="v.type === 'select'" small close @click:close="removeSelectedItem(v.name, index)" |
36 | | - >{{ item.name || item }} |
| 37 | + <v-chip |
| 38 | + v-if="v.type === 'select'" |
| 39 | + small |
| 40 | + close |
| 41 | + @click:close="removeSelectedItem(v.name, index)" |
| 42 | + > |
| 43 | + {{ item.name || item }} |
37 | 44 | </v-chip> |
38 | 45 | </template> |
39 | 46 | </v-select> |
@@ -346,13 +353,15 @@ export default { |
346 | 353 | }, |
347 | 354 |
|
348 | 355 | removeSelectedItem(varName, index) { |
349 | | - if (!Object.prototype.hasOwnProperty.call(this.editedEnvironment, varName) || !Array.isArray(this.editedEnvironment[varName])) { |
| 356 | + const env = this.editedEnvironment; |
| 357 | + if (!Object.prototype.hasOwnProperty.call(env, varName) || !Array.isArray(env[varName])) { |
350 | 358 | // Optionally, log a warning for debugging: |
351 | 359 | // console.warn(`removeSelectedItem: '${varName}' is not a valid array key in editedEnvironment.`); |
352 | 360 | return; |
353 | 361 | } |
354 | | - if (index < this.editedEnvironment[varName].length) { |
355 | | - this.editedEnvironment[varName].splice(index, 1); |
| 362 | +
|
| 363 | + if (index < env[varName].length) { |
| 364 | + env[varName].splice(index, 1); |
356 | 365 | } |
357 | 366 | }, |
358 | 367 | }, |
|
0 commit comments