How to destroy a VueJS component that is being cached by

前端 未结 4 1526
天涯浪人
天涯浪人 2021-01-13 17:16

I have a Vue component that\'s kept alive using Vue\'s element for caching purposes. However, the problem I am having right now is that once I sign out of one account and c

4条回答
  •  再見小時候
    2021-01-13 17:59

    I've managed to solve my issue in the following way. Essentially, if the user is logged in, keep the dashboard alive. Else, don't keep the dashboard alive. I check if the user is logged in or out every time the route changes by "watching" the route (see below). If you are reading this and have a more elegant solution - I'd love to hear it.

    The following is the code for my root component

    
    
    
    

提交回复
热议问题