vue.jsnuxt.jsprimevue

PrimeVue how to listen to emits?


I have this piece of code with the Galleria component of PrimeVue.

    <PrimeGalleria @update:visible="onVisible()" :value="images" v-model:visible="isZoomed" :fullScreen="true">
        <template #item="slotProps">
            <img :src="slotProps.item.value" style="width: 100%; display: block" />
        </template>
    </PrimeGalleria>

According to https://primevue.org/galleria/ api section, I should be able to listen to to the update:visible emit, why my onVisible function isn't executed?


Solution

  • As can be seen in the implementation, update:visible is emitted when the value is set to false.

    v-model:visible and update:visible aren't supposed to be used at the same time, it's either one or another. If the intention is to react to all value changes in a parent, this needs to be done in isZoomed watcher together with v-model:visible="isZoomed".