What if vue uses event binding to carry parameters that override the default parameters of the function?

problem description

want to do the transition effect, but css can not complete, because you need to calculate the number of child elements, so use the js of transition, they have several default events, I want to bring the number of child elements in, but found that this number covers all the parameters, I would like to ask what to do.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

<transition @before-enter="bEnter(item1.children.length)" @enter="enter" @leave="leave">
bEnter(el){   //el
    console.log(arguments)
    el.style.height = 0;
    el.style.opacity = 0;
}

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

although it can be used by clicking to record the number of length, it is more convenient to use parameters. I want to know how to use this place so that it does not replace the default parameters of the event function.

Apr.13,2022

< transition @ before-enter= "(el) = > bEnter (el,item1.children.length)" @ enter= "enter @ leave=" leave ">


in this way, you can add any parameter

<transition @before-enter="((el) => {bEnter(el,item1.children.length)})" @enter="enter" @leave="leave">

maybe this is what you want
https://cn.vuejs.org/v2/api/-sharp...
pass $event in the click event
clipboard.png

Menu