How does the vue destroyed () function change a css style?

in vue, this is a window departure event. I want to change the style of body through this, but it seems to have misreported

.

how can I change its style?


wants to use the DOM operation, document.querySelector ('body'). Style.overflow =' hidden'


what body is never defined maybe you mean window.document.body but your editor doesn't know.
in addition, direct dom operation is not recommended. You can use eventBus or vuex to notify the root component or any node you want to change the color of the specified dom by className

Menu