How do vue custom components respond to events in the parent component?

problem description

I customized a cont component, then referenced it in another component A, and placed some content in the cont component. How do I define events? For example, click, my way of writing is not supported, what should the correct way of writing look like? Is there a boss who loses a portal? thank you

the environmental background of the problems and what methods you have tried

related codes

/ / A component
< cont >
< div @ click= "click" > < / div >
< / cont >

methods: {
        click: () => {
            console.log("")
        }
    },

/ / cont components
< template >

<div class="content">
    <slot></slot>
</div>

< / template >

what result do you expect? What is the error message actually seen?

Jul.20,2021

https://cn.vuejs.org/v2/api/-sharp.

clipboard.png


officials say that methods cannot use the arrow function
and then if you want to trigger it in the component, either $emit, or this.$props.click ()

Menu