mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-01 11:37:58 +00:00
fix: Use addEventListener instead of onmessage to listen to chatwoot-dashboard-app:fetch-info (#10342)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import LoadingState from 'dashboard/components/widgets/LoadingState.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
LoadingState,
|
||||
@@ -51,19 +52,19 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
window.onmessage = e => {
|
||||
if (
|
||||
typeof e.data !== 'string' ||
|
||||
e.data !== 'chatwoot-dashboard-app:fetch-info'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
this.onIframeLoad(0);
|
||||
};
|
||||
window.addEventListener('message', this.triggerEvent);
|
||||
},
|
||||
unmounted() {
|
||||
window.removeEventListener('message', this.triggerEvent);
|
||||
},
|
||||
methods: {
|
||||
triggerEvent(event) {
|
||||
if (!this.isVisible) return;
|
||||
if (event.data === 'chatwoot-dashboard-app:fetch-info') {
|
||||
this.onIframeLoad(0);
|
||||
}
|
||||
},
|
||||
getFrameId(index) {
|
||||
return `dashboard-app--frame-${this.position}-${index}`;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user