Skip to content

Send message from Luigi Client to Luigi container #3682

Closed Answered by hardl
BossHogg97 asked this question in Q&A
Discussion options

You must be logged in to vote

Rather a vuejs lifecycle issue, try to wrap it with onMount to make sure the dom element has been created

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import '@luigi-project/container'
...
const luigiContainerRef = ref(null)
...
onMounted(() => {
  luigiContainerRef.value.addEventListener('custom-message', (e) => {
      if (e.detail?.id === 'language-reset') {
        console.log('Language reset [HORIZON]', e.detail.data)
      }
    })
})

</script>
<template>
     .....
     <luigi-container ref="luigiContainerRef" :viewURL="props.url" :context="contextJson" />
     .....
</template>

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@BossHogg97
Comment options

@hardl
Comment options

@BossHogg97
Comment options

@hardl
Comment options

Answer selected by BossHogg97
@BossHogg97
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants