mirror of
				https://github.com/KevinMidboe/vue-js-modal.git
				synced 2025-10-29 18:00:20 +00:00 
			
		
		
		
	Fixed bug where state function argument was not considered (#5)
This commit is contained in:
		| @@ -137,7 +137,11 @@ | |||||||
|     created () { |     created () { | ||||||
|       Modal.event.$on('toggle', (name, state, params) => { |       Modal.event.$on('toggle', (name, state, params) => { | ||||||
|         if (name === this.name) { |         if (name === this.name) { | ||||||
|           this.toggle(!this.visible, params) |           if (typeof state === 'undefined') { | ||||||
|  |             state = !this.visible | ||||||
|  |           } | ||||||
|  |  | ||||||
|  |           this.toggle(state, params) | ||||||
|         } |         } | ||||||
|       }); |       }); | ||||||
|  |  | ||||||
| @@ -216,7 +220,7 @@ | |||||||
|         if (!stopEventExecution) { |         if (!stopEventExecution) { | ||||||
|           const afterEvent = this.genEventObject({ state, params }) |           const afterEvent = this.genEventObject({ state, params }) | ||||||
|  |  | ||||||
|           this.visible = !!state |           this.visible = state | ||||||
|           this.$emit(afterEventName, afterEvent) |           this.$emit(afterEventName, afterEvent) | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
|   | |||||||
| @@ -13,6 +13,10 @@ const ModalPlugin = { | |||||||
|  |  | ||||||
|       hide(name, params) { |       hide(name, params) { | ||||||
|         ModalPlugin.event.$emit('toggle', name, false, params) |         ModalPlugin.event.$emit('toggle', name, false, params) | ||||||
|  |       }, | ||||||
|  |  | ||||||
|  |       toggle(name, params) { | ||||||
|  |         ModalPlugin.event.$emit('toggle', name, undefined, params) | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user