function handleKeepAlive(to) {
  if (to.matched && to.matched.length > 2) {
    for (let i = 0; i < to.matched.length; i++) {
      const element = to.matched[i]
      if (element.components.default.name === 'Layout') {
        to.matched.splice(i, 1)
        handleKeepAlive(to)
      }
    }
  }
}
/**
 * Handle redundant layout: router-view and keep the current component under the first layer index <router-view>
 * This method cannot filter the on-demand loading <layout> used for nested routing
 * @param to
 */
Handle redundant layout: router-view and keep the current component under the first layer index 
This method cannot filter the on-demand loading  used for nested routing
@param to
Handle redundant layout : router - view and keep the current component under the first layer index This method cannot filter the on - demand loading used for nested routing @param to
function handleKeepAlive(to) {
  if (to.matched && to.matched.length > 2) {
    for (let i = 0; i < to.matched.length; i++) {
      const element = to.matched[i]
      if (element.components.default.name === 'Layout') {
        to.matched.splice(i, 1)
        handleKeepAlive(to)
      }
    }
  }
}
function handleKeepAlive ( to ) { if ( to . matched && to . matched . length > 2 ) { for ( let i = 0 ; i < to . matched . length ; i ++ ) { const element = to . matched [ i ] if ( element . components . default . name === 'Layout' ) { to . matched . splice ( i , 1 ) handleKeepAlive ( to ) } } } }
Handle redundant layout: router-view and keep the current component under the first layer index <router-view>
 This method cannot filter the on-demand loading <layout> used for nested routing
 @param to
Handle redundant layout : router - view and keep the current component under the first layer index <router - view > This method cannot filter the on - demand loading <layout > used for nested routing @param to