Vue 2 not working with and key

前端 未结 4 1830
旧巷少年郎
旧巷少年郎 2020-12-19 16:55

I\'m using vue-router with a series of components like tabs. Each is a tab and the space below is the . Two

4条回答
  •  情深已故
    2020-12-19 17:51

    I don't think you will be able to cache router-view using keep-alive. From the documentation of keep-alive:

    keep-alive does not work with functional components because they do not have instances to be cached.

    And router-view is a functional component, from the documentation:

    The component is a functional component that renders the matched component for the given path.

    To make this work, you need to have dynamic component inside keep-alive, like following:

    
      
    
    

提交回复
热议问题