From d603b0d418204bdef9c72448c10b3ec83be5118f Mon Sep 17 00:00:00 2001 From: ousiri Date: Mon, 8 Oct 2018 21:27:36 +0800 Subject: [PATCH] feat: allow nuxt-child to pass keep-alive props to keep-alive (#4067) Adds the ability to configure the props of keep-alive on nuxt-child. ## Types of changes - [ ] Bug fix (a non-breaking change which fixes an issue) - [x] New feature (a non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Description In development, I found it impossible to configure the props of keep-alive when using nuxt-child, like ```exclude```. This PR adds a special prop to nuxt-child named keepAliveProps to allow developer to configure it. ```html ``` ## Checklist: - [x] My change requires a change to the documentation. - [x] I have updated the documentation accordingly. (PR: https://github.com/nuxt/docs/pull/836) - [ ] I have added tests to cover my changes (if not applicable, please state why) - [x] All new and existing tests are passing. --- lib/app/components/nuxt-child.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app/components/nuxt-child.js b/lib/app/components/nuxt-child.js index b22084596a..c1d2c4b6e3 100644 --- a/lib/app/components/nuxt-child.js +++ b/lib/app/components/nuxt-child.js @@ -1,7 +1,7 @@ export default { name: 'nuxt-child', functional: true, - props: ['keepAlive'], + props: ['keepAlive', 'keepAliveProps'], render (h, { parent, data, props }) { data.nuxtChild = true const _parent = parent @@ -44,7 +44,7 @@ export default { ] if (typeof props.keepAlive !== 'undefined') { routerView = [ - h('keep-alive', routerView) + h('keep-alive', { props: props.keepAliveProps }, routerView) ] } return h('transition', {