From 4ec4033146ea788e1b45b592647bd69ce843e83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr> Date: Thu, 29 Jun 2023 14:54:04 +0200 Subject: [PATCH] add button delete option & add and delete function --- .../FeatureType/FeatureTypeCustomForm.vue | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/FeatureType/FeatureTypeCustomForm.vue b/src/components/FeatureType/FeatureTypeCustomForm.vue index a410b189..bdb0fc4f 100644 --- a/src/components/FeatureType/FeatureTypeCustomForm.vue +++ b/src/components/FeatureType/FeatureTypeCustomForm.vue @@ -180,7 +180,7 @@ class="draggable-row" > <i - class="th icon" + class="th icon grey" aria-hidden="true" /> <input @@ -191,6 +191,10 @@ class="options-field" @change="updateOptionValue(index, $event)" > + <i + class="trash icon grey" + @click="deleteOption(index)" + ></i> </div> </div> <div class="ui buttons"> @@ -430,7 +434,7 @@ export default { this.form.options.value = currentOptionsList; this.updateStore(); }, - + initSortable() { this.sortable = new Sortable(document.getElementById(`list-options-${this.customForm.dataKey}`), { animation: 150, @@ -440,9 +444,13 @@ export default { onEnd: this.updateOptionOrder, }); }, - + addOption() { - console.log('addOption'); + this.form.options.value.push(''); + }, + + deleteOption(index) { + this.form.options.value.splice(index, 1); }, updateStore() { @@ -553,7 +561,9 @@ export default { align-items: baseline; margin-bottom: 1em; input { - margin-left: .5em !important; + margin: 0 .5em !important; + } + i.icon.trash { } } </style> -- GitLab