Notes--About the multiple triggering of Vue listening events

@编记 – about the issue of multiple triggering of Vue listening events

Cause of the problem

The cause of the problem is that in the process of checking the interface call, it is found that the interface is always called repeatedly, and the parameters are passed the same. Then troubleshoot.

Problem Description

In the process of troubleshooting, I saw the global monitor emit, emit,The use of e mi t , on. Then during the test, it was found that the method of $emit is always called multiple times, and the number of triggers is uncertain. Then identified the problem.

problem solution

Use $off to remove. Writing this in beforeDestory in the life cycle can solve the solution

Guess you like

Origin blog.csdn.net/weixin_44358678/article/details/126243371