feat(nuxt-child): bind transition calls to parent

WIP for #566
This commit is contained in:
Pooya Parsa 2017-06-12 04:13:39 +04:30
parent 76a1969da1
commit 2b2d9e5e71

View File

@ -30,7 +30,7 @@ export default {
functional: true, functional: true,
render (h, { parent, data }) { render (h, { parent, data }) {
data.nuxtChild = true data.nuxtChild = true
const _parent = parent
const transitions = parent.$nuxt.nuxt.transitions const transitions = parent.$nuxt.nuxt.transitions
const defaultTransition = parent.$nuxt.nuxt.defaultTransition const defaultTransition = parent.$nuxt.nuxt.defaultTransition
let depth = 0 let depth = 0
@ -51,7 +51,7 @@ export default {
let listeners = {} let listeners = {}
listenersKeys.forEach((key) => { listenersKeys.forEach((key) => {
if (typeof transition[key] === 'function') { if (typeof transition[key] === 'function') {
listeners[key] = transition[key] listeners[key] = transition[key].bind(_parent)
} }
}) })
return h('transition', { return h('transition', {