Passing parameters to event listeners / handlers

前端 未结 8 1345
清酒与你
清酒与你 2020-12-06 06:40

How do you pass parameters / variables through event listeners? I\'ve overcome this problem fairly effectively using anonymous functions; which is an incredibly simple solut

8条回答
  •  情深已故
    2020-12-06 07:02

    Yes I know what you mean. What I do is to extend the event and so dispatch a custom event. This way I can create properties in the custom event that contain the necessary data. It seems clean but does require a bit of effort. It is not ideal but I don't know of a significantly better way.

提交回复
热议问题