Moment For Technology

Solve the click-lab option problem for the Cascader component of elementUi

Posted on Dec. 2, 2022, 6:10 p.m. by Sarah Stewart
Category: The front end Tag: The front end element

Since the product does not want the previous checkbox, it also needs to be selected by clicking lable

Look at n more schemes in front of the box do not know how to hide, but click lable can be selected effect is still very simple.

How it works: The change event of the elementUI component is placed on the preceding radio, and the span after redio does not register the event. You just need to manually register the component on the span to call the radio event.

setInterval(function () { document.querySelectorAll('.el-cascader-node__label').forEach(el = { el.onclick = function ()  { if (this.previousElementSibling) } }) }, 1000) },Copy the code

And we're done!

About (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.