mirror of
https://github.com/KevinMidboe/vue-js-modal.git
synced 2025-10-29 18:00:20 +00:00
Update README.md
This commit is contained in:
11
README.md
11
README.md
@@ -63,7 +63,7 @@ methods: {
|
|||||||
| closed | Emits right before modal is destoyed |
|
| closed | Emits right before modal is destoyed |
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```
|
```vue
|
||||||
<template>
|
<template>
|
||||||
<modal name="example"
|
<modal name="example"
|
||||||
:width="300"
|
:width="300"
|
||||||
@@ -79,17 +79,17 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
time: 0,
|
time: 0,
|
||||||
duration: 8000
|
duration: 5000
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
beforeOpen (event) {
|
beforeOpen (event) {
|
||||||
console.log(event);
|
console.log(event)
|
||||||
// Set the opening time of the modal
|
// Set the opening time of the modal
|
||||||
this.time = Date.now()
|
this.time = Date.now()
|
||||||
},
|
},
|
||||||
beforeClose (event) {
|
beforeClose (event) {
|
||||||
console.log(event);
|
console.log(event)
|
||||||
// If modal was open less then 5000 ms - prevent closing it
|
// If modal was open less then 5000 ms - prevent closing it
|
||||||
if (this.time + this.duration < Date.now()) {
|
if (this.time + this.duration < Date.now()) {
|
||||||
event.stop()
|
event.stop()
|
||||||
@@ -100,6 +100,9 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This example, initializes `time` variable every time the modal is being opened.
|
||||||
|
And then forbits closing it for the next 5000 ms
|
||||||
|
|
||||||
### Developers
|
### Developers
|
||||||
|
|
||||||
To run an example:
|
To run an example:
|
||||||
|
|||||||
Reference in New Issue
Block a user