Why the scrolling event written in the parent component is triggered by the child component, but the child component does not report an error after the page is refreshed, and how to prevent it from continuing to the child component

above

222.fuchuangclassclass

you can see that I am scrolling, the page refreshed, do not report wrong, puzzled, do not know why, ask the boss to tell, thank you!

May.31,2022

suspects that the relationship between your two components is not a so-called "father-son" relationship. Because you scroll after the "child" component refreshes the page, although there is no error, it does not print anything, indicating that the scrolling event is not mounted, further indicating that the mounted life cycle of the "parent" component is not executed.

and when you enter the "child" component from the "parent" component, scrolling will report an error, because you do not clear the scrolling event when the "parent" component is uninstalled, resulting in entering a new page and cannot find the class class fuchuang. So it would be nice to clear the scrolling event when the component is uninstalled.

I guess so.


your description lacks more detail.

1. Your understanding of the parent and child components is wrong.

2. The reason for reporting an error now is that you bound the onscroll event to body in the so-called "parent component". After entering the so-called "child component", the event on body is not removed. The reason for reporting an error is that it now executes the fc value bit null selected by dom in the event, and then you try to access null.style in your code, so you report an error.

3. Solution: remove body's onscroll event handling in the beforeDestroy declaration cycle of the so-called "parent component".


what is your dispplay:none for

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b6c7-2c2a7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b6c7-2c2a7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?