How to use keep-alive in vuejs?

前端 未结 2 707
逝去的感伤
逝去的感伤 2020-12-29 06:44

Basically, I want to keep alive 2 components in router-view and it works, however, I don\'t know if I am doing it correctly.

 

        
2条回答
  •  执念已碎
    2020-12-29 07:32

    1. We can achieve it by using `

    
    // Render component inside
    
    

    ` special tag which has provided by vueJs.

    2. use life cycle hooks:

    a. activated()

    b. deactivated()

提交回复
热议问题