fixed modal input not clearing
This commit is contained in:
parent
89c56c1fe4
commit
3c62b51ce9
|
|
@ -59,9 +59,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
focusInput() {
|
focusInput() {
|
||||||
setTimeout(() => {
|
this.$refs.fieldName.focus();
|
||||||
this.$refs.fieldName.focus();
|
},
|
||||||
});
|
closedModal() {
|
||||||
|
this.name = '';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
@ -75,6 +76,7 @@ export default {
|
||||||
footer-primary-button-variant="success"
|
footer-primary-button-variant="success"
|
||||||
@submit="submitForm"
|
@submit="submitForm"
|
||||||
@open="focusInput"
|
@open="focusInput"
|
||||||
|
@closed="closedModal"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="form-group row"
|
class="form-group row"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
|
import $ from 'jquery';
|
||||||
|
|
||||||
const buttonVariants = ['danger', 'primary', 'success', 'warning'];
|
const buttonVariants = ['danger', 'primary', 'success', 'warning'];
|
||||||
const sizeVariants = ['sm', 'md', 'lg', 'xl'];
|
const sizeVariants = ['sm', 'md', 'lg', 'xl'];
|
||||||
|
|
||||||
|
|
@ -38,6 +40,12 @@ export default {
|
||||||
return this.modalSize === 'md' ? '' : `modal-${this.modalSize}`;
|
return this.modalSize === 'md' ? '' : `modal-${this.modalSize}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
$(this.$el).on('shown.bs.modal', this.opened).on('hidden.bs.modal', this.closed);
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
$(this.$el).off('shown.bs.modal', this.opened).off('hidden.bs.modal', this.closed);
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
emitCancel(event) {
|
emitCancel(event) {
|
||||||
this.$emit('cancel', event);
|
this.$emit('cancel', event);
|
||||||
|
|
@ -45,10 +53,11 @@ export default {
|
||||||
emitSubmit(event) {
|
emitSubmit(event) {
|
||||||
this.$emit('submit', event);
|
this.$emit('submit', event);
|
||||||
},
|
},
|
||||||
opened({ propertyName }) {
|
opened() {
|
||||||
if (propertyName === 'opacity') {
|
this.$emit('open');
|
||||||
this.$emit('open');
|
},
|
||||||
}
|
closed() {
|
||||||
|
this.$emit('closed');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
@ -60,7 +69,6 @@ export default {
|
||||||
class="modal fade"
|
class="modal fade"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
role="dialog"
|
role="dialog"
|
||||||
@transitionend="opened"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
:class="modalSizeClass"
|
:class="modalSizeClass"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue