ProductModal.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template lang="pug">
  2. modal(name='product-modal' transition='nice-modal-fade' @before-close='beforeClose' :classes="['v--modal', 'product-modal']")
  3. product-form(title='Nuevo Producto' @onAccept='onAccept' @onCancel='onCancel')
  4. </template>
  5. <script>
  6. import ProductForm from '@@/forms/ProductForm'
  7. export default {
  8. components: {
  9. ProductForm
  10. },
  11. props: {
  12. title: {
  13. type: String,
  14. default: ''
  15. },
  16. show: {
  17. type: Boolean,
  18. default: false
  19. }
  20. },
  21. watch: {
  22. show(value) {
  23. if (!value) {
  24. this.$modal.hide('product-modal')
  25. return
  26. }
  27. this.$modal.show('product-modal')
  28. }
  29. },
  30. methods: {
  31. beforeClose(e) {
  32. if (this.show) {
  33. e.stop()
  34. }
  35. },
  36. onAccept(value) {
  37. this.$emit('onAccept', value)
  38. },
  39. onCancel() {
  40. this.$emit('onCancel')
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="sass">
  46. </style>