From 596364b6a4825a2fbcad046a6009cf881fef5f39 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Thu, 6 Sep 2018 14:27:33 +0200 Subject: [PATCH] Add new element and change type at correct position --- client/src/components/AddContentElement.vue | 4 +++- client/src/components/NewContentBlockWizard.vue | 17 +++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/client/src/components/AddContentElement.vue b/client/src/components/AddContentElement.vue index ceb86084..65e9a22a 100644 --- a/client/src/components/AddContentElement.vue +++ b/client/src/components/AddContentElement.vue @@ -1,5 +1,5 @@ @@ -8,6 +8,8 @@ import AddIcon from '@/components/icons/AddIcon'; export default { + props: ['index'], + components: { AddIcon } diff --git a/client/src/components/NewContentBlockWizard.vue b/client/src/components/NewContentBlockWizard.vue index 34c2810b..a1412757 100644 --- a/client/src/components/NewContentBlockWizard.vue +++ b/client/src/components/NewContentBlockWizard.vue @@ -1,18 +1,21 @@ @@ -46,10 +49,8 @@ removeElement(index) { this.elements.splice(index, 1); }, - addElement() { - this.elements.push({ - id: 5 - }) + addElement(index) { + this.elements.splice(index + 1, 0, {}) }, changeType(index) { this.elements.splice(index, 1, {type: 'link'});