Update README.md

This commit is contained in:
Yev Vlasenko
2017-05-04 10:25:48 +01:00
committed by GitHub
parent 024a4325c5
commit a6149f549e

View File

@@ -63,7 +63,7 @@ methods: {
| closed | Emits right before modal is destoyed |
Example:
```
```vue
<template>
<modal name="example"
:width="300"
@@ -79,17 +79,17 @@ export default {
data () {
return {
time: 0,
duration: 8000
duration: 5000
}
},
methods: {
beforeOpen (event) {
console.log(event);
console.log(event)
// Set the opening time of the modal
this.time = Date.now()
},
beforeClose (event) {
console.log(event);
console.log(event)
// If modal was open less then 5000 ms - prevent closing it
if (this.time + this.duration < Date.now()) {
event.stop()
@@ -100,6 +100,9 @@ export default {
</script>
```
This example, initializes `time` variable every time the modal is being opened.
And then forbits closing it for the next 5000 ms
### Developers
To run an example: