Compare commits
2 Commits
vue3
...
enh/create
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0949886348 | ||
|
|
e4ccf431a4 |
@@ -53,13 +53,13 @@
|
|||||||
|
|
||||||
<form v-if="showAddCard" class="stack--card-add" @submit.prevent="clickAddCard()">
|
<form v-if="showAddCard" class="stack--card-add" @submit.prevent="clickAddCard()">
|
||||||
<label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add a new card') }}</label>
|
<label for="new-stack-input-main" class="hidden-visually">{{ t('deck', 'Add a new card') }}</label>
|
||||||
<input id="new-stack-input-main"
|
<textarea id="new-stack-input-main"
|
||||||
v-model="newCardTitle"
|
v-model="newCardTitle"
|
||||||
v-focus
|
v-focus
|
||||||
type="text"
|
type="text"
|
||||||
class="no-close"
|
class="no-close"
|
||||||
placeholder="Add a new card"
|
placeholder="Add a new card"
|
||||||
required>
|
required />
|
||||||
|
|
||||||
<input class="icon-confirm"
|
<input class="icon-confirm"
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -161,14 +161,32 @@ export default {
|
|||||||
this.editing = false
|
this.editing = false
|
||||||
},
|
},
|
||||||
clickAddCard() {
|
clickAddCard() {
|
||||||
|
|
||||||
|
const match = /\r|\n/.exec(this.newCardTitle)
|
||||||
|
if (match) {
|
||||||
|
console.log(match)
|
||||||
|
const results = this.newCardTitle.split(match[0])
|
||||||
|
results.forEach((line) => {
|
||||||
|
|
||||||
|
this.addCard(line)
|
||||||
|
})
|
||||||
|
|
||||||
|
this.newCardTitle = ''
|
||||||
|
this.showAddCard = false
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.addCard(this.newCardTitle)
|
||||||
|
this.newCardTitle = ''
|
||||||
|
this.showAddCard = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addCard(title) {
|
||||||
const newCard = {
|
const newCard = {
|
||||||
title: this.newCardTitle,
|
title: title,
|
||||||
stackId: this.stack.id,
|
stackId: this.stack.id,
|
||||||
boardId: this.stack.boardId,
|
boardId: this.stack.boardId,
|
||||||
}
|
}
|
||||||
this.$store.dispatch('addCard', newCard)
|
this.$store.dispatch('addCard', newCard)
|
||||||
this.newCardTitle = ''
|
|
||||||
this.showAddCard = false
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user