setup
function takes two arguments, First one is props
.
And the second one is context
which exposes three component properties, attrs
, slots
and emit
.
You can access emit from context like:
export default {
setup(props, context) {
context.emit('event');
},
};
or
export default {
setup(props, { emit }) {
emit('event');
},
};
Source