0

Im using Nuxtjs2 with prismic slicemachine. I have recently learned that you can pass down custom props to slices in the slice-zone by using :context="yourData" as a prop. From these slices i want to emit data back up to the parent component containing this slice-zone.

Using the "normal way" of emiting has not been working.

Child:

`this.$emit('func', value);`

Parent

`<slice-zone 
    :components="components" 
    :slices="document.data.slices" 
    :context="document" 
    @func="updateValue"
/>`

UpdateValue in this case would never run

Is there a special way of doing this to the slice-zone or is it not possible?

Update:

Got help from elsewhere, the solution that worked for me was:

// slice component
this.$nuxt.$emit('eventName', value)
// page/component etc..
this.$nuxt.$on('eventName', (value) => {
    ...
})

0 Answers0