Article From:https://www.cnblogs.com/wangyao521/p/9970170.html

 

   

Three other hooks do not appear on the map:

  1.activatedThe lifecycle hook function is invoked when the keep-alive component is activated, and the hook is not invoked during server-side rendering.

  2.deactivatedThe life cycle hook function is called when the keep-alive component is deactivated. The hook is not called during server-side rendering.

  3.vue2.5.0New hook function errorCaptured

  Called when an error from a descendant component is caught. This hook receives three parameters:

  An error object, an instance of the component where the error occurred, and a string containing the error source information.
  This hook can return false to prevent the error from continuing to propagate upwards.

 

  You can modify the state of components in this hook. Therefore, it is very important to set other short-circuit conditions in the template or rendering function.
  It prevents the component from entering an infinite rendering cycle when an error is caught.

  By default, if the global config. errorHandler is defined, all errors will still be sent, so these errors will still be reported to a single analysis service.

  If there are multiple errorCaptured hooks in a component’s inheritance or parent subordinate link, they will be evoked one by one by the same error.

  If the errorCaptured hook itself throws an error, the new error and the original captured error will be sent to the global config. errorHandler.

  An errorCaptured hook can return false to prevent errors from continuing to propagate upwards. Essentially, it means that “this mistake has been solved and should be ignored”.
  It prevents any other errorCaptured hook and global config. errorHandler that will be aroused by this error.

  Note: If there are any mistakes, please point them out in time and study together. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *