diff options
| author | Andrew <saintruler@gmail.com> | 2019-07-19 00:11:33 +0400 |
|---|---|---|
| committer | Andrew <saintruler@gmail.com> | 2019-07-19 00:11:33 +0400 |
| commit | bca39a475dfd3aab0b31709b2c4873398901b00c (patch) | |
| tree | b7b5ebfb28a80a9793b6bc084bd6de75f976e7f1 /day9/task5_vue/src/components/EditFormBox.vue | |
| parent | 70c3b1e1c5e1bbc354fe5961bae613bd23c4d8a2 (diff) | |
Кнопка удаления ряда теперь действительно работает.
Diffstat (limited to 'day9/task5_vue/src/components/EditFormBox.vue')
| -rw-r--r-- | day9/task5_vue/src/components/EditFormBox.vue | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/day9/task5_vue/src/components/EditFormBox.vue b/day9/task5_vue/src/components/EditFormBox.vue index 53bfd8b..389b549 100644 --- a/day9/task5_vue/src/components/EditFormBox.vue +++ b/day9/task5_vue/src/components/EditFormBox.vue @@ -1,7 +1,7 @@ <template> <div class="backgroundTint shown"> <div class="contentBox shown"> - <form id="tableForm" action="/api/update" method="post"> + <form ref="tableForm" action="/api/actionNotChanged" method="post"> <div class="formRow"> <div class="formRow-label">service_id</div> @@ -88,13 +88,11 @@ </div> </div> - <div class="formButtons" v-if="formType === 'update'"> + <div class="formButtons"> <button type="button" @click="cancelCallback">Cancel</button> - <button type="submit">Update</button> - </div> - <div class="formButtons" v-else-if="formType === 'create'"> - <button type="button">Cancel</button> - <button type="submit">Create</button> + + <button type="submit" v-if="formType === 'update'">Update</button> + <button type="submit" v-else-if="formType === 'create'">Create</button> </div> </form> </div> @@ -106,14 +104,12 @@ name: "EditFormBox", props: ['formType', 'cancelCallback', 'tableRow'], - data() { - return { - row: this.tableRow - } - }, - mounted() { - console.log(this.row); + let action = ''; + if (this.formType === 'create') action = '/api/add'; + else if (this.formType === 'update') action = '/api/update'; + + this.$refs.tableForm.action = action; } } </script> |