Moved trim to blur event (#6)

This commit is contained in:
Daniel J. Summers 2017-09-25 22:41:01 -05:00
parent 3a0ac7ce97
commit f085c47c6e
2 changed files with 8 additions and 2 deletions

View File

@ -4,7 +4,7 @@ span
el-dialog(title='Edit Prayer Request' :visible.sync='editVisible') el-dialog(title='Edit Prayer Request' :visible.sync='editVisible')
el-form(:model='form' :label-position='top') el-form(:model='form' :label-position='top')
el-form-item(label='Prayer Request') el-form-item(label='Prayer Request')
el-input(type='textarea' v-model.trim='form.requestText' :rows='10') el-input(type='textarea' v-model='form.requestText' :rows='10' @blur="trimText()")
el-form-item(label='Also Mark As') el-form-item(label='Also Mark As')
el-radio-group(v-model='form.status') el-radio-group(v-model='form.status')
el-radio-button(label='Updated') Updated el-radio-button(label='Updated') Updated
@ -42,6 +42,9 @@ export default {
openDialog () { openDialog () {
this.editVisible = true this.editVisible = true
}, },
trimText () {
this.form.requestText = this.form.requestText.trim()
},
async saveRequest () { async saveRequest () {
await this.$store.dispatch(actions.UPDATE_REQUEST, { await this.$store.dispatch(actions.UPDATE_REQUEST, {
progress: this.$Progress, progress: this.$Progress,

View File

@ -4,7 +4,7 @@ div
el-dialog(title='Add a New Prayer Request' :visible.sync='showNewVisible') el-dialog(title='Add a New Prayer Request' :visible.sync='showNewVisible')
el-form(:model='form' :label-position='top') el-form(:model='form' :label-position='top')
el-form-item(label='Prayer Request') el-form-item(label='Prayer Request')
el-input(type='textarea' v-model.trim='form.requestText' :rows='10') el-input(type='textarea' v-model='form.requestText' :rows='10' @blur='trimText()')
span.dialog-footer(slot='footer') span.dialog-footer(slot='footer')
el-button(@click='closeDialog()') Cancel el-button(@click='closeDialog()') Cancel
el-button(type='primary' @click='saveRequest()') Save el-button(type='primary' @click='saveRequest()') Save
@ -34,6 +34,9 @@ export default {
openDialog () { openDialog () {
this.showNewVisible = true this.showNewVisible = true
}, },
trimText () {
this.form.requestText = this.form.requestText.trim()
},
async saveRequest () { async saveRequest () {
await this.$store.dispatch(actions.ADD_REQUEST, { await this.$store.dispatch(actions.ADD_REQUEST, {
progress: this.$Progress, progress: this.$Progress,