mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix: Fix Layouts transitions
This commit is contained in:
parent
e80a77782a
commit
fb44c2eb8e
@ -18,16 +18,20 @@ export default {
|
||||
head: <%= serialize(head).replace('titleTemplate(', 'function(') %>,
|
||||
render(h, props) {
|
||||
<% if (loading) { %>const loadingEl = h('nuxt-loading', { ref: 'loading' })<% } %>
|
||||
const layoutEl = h(this.nuxt.err ? 'nuxt' : this.layout, {
|
||||
const layoutEl = h(this.layout || 'nuxt')
|
||||
const templateEl = h('div', {
|
||||
domProps: {
|
||||
id: '__layout'
|
||||
},
|
||||
key: this.layoutName
|
||||
})
|
||||
}, [ layoutEl ])
|
||||
|
||||
const transitionEl = h('transition', {
|
||||
props: {
|
||||
name: '<%= layoutTransition.name %>',
|
||||
mode: '<%= layoutTransition.mode %>'
|
||||
}
|
||||
}, [ layoutEl ])
|
||||
}, [ templateEl ])
|
||||
|
||||
return h('div',{
|
||||
domProps: {
|
||||
|
@ -2,26 +2,11 @@ export default {
|
||||
name: 'nuxt-child',
|
||||
functional: true,
|
||||
render (h, { parent, data }) {
|
||||
const nuxt = parent.$root.nuxt
|
||||
const component = parent.$route.matched[0].components.default
|
||||
|
||||
const layoutUid = parent._uid
|
||||
const layoutName = component.options ? component.options.layout : null
|
||||
|
||||
// If we're changing layout render the stored vnode
|
||||
if (nuxt._layoutUid === layoutUid &&
|
||||
nuxt._layoutName !== layoutName
|
||||
) {
|
||||
return nuxt._childVnode
|
||||
}
|
||||
|
||||
nuxt._layoutUid = layoutUid
|
||||
nuxt._layoutName = layoutName
|
||||
|
||||
data.nuxtChild = true
|
||||
const _parent = parent
|
||||
const transitions = parent.$nuxt.nuxt.transitions
|
||||
const defaultTransition = parent.$nuxt.nuxt.defaultTransition
|
||||
|
||||
let depth = 0
|
||||
while (parent) {
|
||||
if (parent.$vnode && parent.$vnode.data.nuxtChild) {
|
||||
@ -44,14 +29,12 @@ export default {
|
||||
}
|
||||
})
|
||||
|
||||
nuxt._childVnode = h('transition', {
|
||||
return h('transition', {
|
||||
props: transitionProps,
|
||||
on: listeners
|
||||
}, [
|
||||
h('router-view', data)
|
||||
])
|
||||
|
||||
return nuxt._childVnode
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user