nuxt-child styling

This commit is contained in:
Pooya Parsa 2017-10-07 18:29:36 +03:30
parent 991d5f70ea
commit b6f2405e7e

View File

@ -1,38 +1,3 @@
import Vue from 'vue'
const transitionsKeys = [
'name',
'mode',
'appear',
'css',
'type',
'duration',
'enterClass',
'leaveClass',
'appearClass',
'enterActiveClass',
'enterActiveClass',
'leaveActiveClass',
'appearActiveClass',
'enterToClass',
'leaveToClass',
'appearToClass'
]
const listenersKeys = [
'beforeEnter',
'enter',
'afterEnter',
'enterCancelled',
'beforeLeave',
'leave',
'afterLeave',
'leaveCancelled',
'beforeAppear',
'appear',
'afterAppear',
'appearCancelled'
]
export default { export default {
name: 'nuxt-child', name: 'nuxt-child',
functional: true, functional: true,
@ -45,7 +10,10 @@ export default {
// If we're changing layout render the stored vnode // If we're changing layout render the stored vnode
if (nuxt._layoutUid === layoutUid && if (nuxt._layoutUid === layoutUid &&
nuxt._layoutName !== layoutName) return nuxt._childVnode nuxt._layoutName !== layoutName
) {
return nuxt._childVnode
}
nuxt._layoutUid = layoutUid nuxt._layoutUid = layoutUid
nuxt._layoutName = layoutName nuxt._layoutName = layoutName
@ -62,6 +30,7 @@ export default {
parent = parent.$parent parent = parent.$parent
} }
data.nuxtChildDepth = depth data.nuxtChildDepth = depth
const transition = transitions[depth] || defaultTransition const transition = transitions[depth] || defaultTransition
let transitionProps = {} let transitionProps = {}
transitionsKeys.forEach((key) => { transitionsKeys.forEach((key) => {
@ -86,3 +55,37 @@ export default {
return nuxt._childVnode return nuxt._childVnode
} }
} }
const transitionsKeys = [
'name',
'mode',
'appear',
'css',
'type',
'duration',
'enterClass',
'leaveClass',
'appearClass',
'enterActiveClass',
'enterActiveClass',
'leaveActiveClass',
'appearActiveClass',
'enterToClass',
'leaveToClass',
'appearToClass'
]
const listenersKeys = [
'beforeEnter',
'enter',
'afterEnter',
'enterCancelled',
'beforeLeave',
'leave',
'afterLeave',
'leaveCancelled',
'beforeAppear',
'appear',
'afterAppear',
'appearCancelled'
]