How to `emit` event out of `setup` method in vue3?

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

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)