Skip to content

Commit f88802d

Browse files
committed
Add ready event
1 parent a5d40d7 commit f88802d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
4949

5050
```html
5151
<template>
52-
<grid :columns="columns" :rows="rows" ref="myTable"></grid>
52+
<grid :columns="columns" :rows="rows" ref="myTable" @ready="myMethod"></grid>
5353
</template>
5454

5555
<script>
@@ -68,6 +68,11 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
6868
['Chevrolet', 'Cruz', '2018', 'White']
6969
]
7070
}
71+
},
72+
methods: {
73+
myMethod() {
74+
console.log("It's ready!")
75+
}
7176
}
7277
}
7378
</script>

examples/basic/hello-world.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ export default {
1414
]
1515
}
1616
},
17+
methods: {
18+
log(text) {
19+
console.log(text)
20+
}
21+
},
1722
template: `
18-
<div><grid :columns="columns" :rows="rows"></grid></div>
23+
<div><grid :columns="columns" :rows="rows" @ready="log('Hi to you too!')"></grid></div>
1924
`
2025
}

src/gridjs-vue.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ export default {
204204
},
205205
mounted() {
206206
this.assignTheme()
207-
208207
this.resize = window.addEventListener('resize', () => this.update(), true)
208+
this.$nextTick(() => this.$emit('ready'))
209209
},
210210
destroyed() {
211211
// unload from memory

0 commit comments

Comments
 (0)