mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-29 23:02:42 +00:00
Fix: transition property beeing a function
This commit is contained in:
parent
b6d82a7c5b
commit
664ce12662
@ -14,20 +14,21 @@ let router
|
||||
<%= (store ? 'let store' : '') %>
|
||||
|
||||
function mapTransitions(Components, to, from) {
|
||||
function componentTransitions(component) {
|
||||
const componentTransitions = (component) => {
|
||||
if (!component || !component.options || !component.options.transition) {
|
||||
return {}
|
||||
}
|
||||
if(typeof component.options.transition === 'function') {
|
||||
return component.options.transition(to, from)
|
||||
let transition = component.options.transition
|
||||
if (typeof transition === 'function') {
|
||||
transition = transition(to, from)
|
||||
}
|
||||
return component.options.transition
|
||||
return (typeof transition === 'string' ? { name: transition } : transition)
|
||||
}
|
||||
return Components.map((Component) => {
|
||||
// Clone original object to prevent overrides
|
||||
const transitions = Object.assign({}, componentTransitions(Component))
|
||||
// Combine transitions & prefer *leave* transitions of 'from' route
|
||||
if(from && from.matched.length && from.matched[0].components.default) {
|
||||
// Combine transitions & prefer `leave` transitions of 'from' route
|
||||
if (from && from.matched.length && from.matched[0].components.default) {
|
||||
const from_transitions = componentTransitions(from.matched[0].components.default)
|
||||
Object.keys(from_transitions)
|
||||
.filter(key => from_transitions[key] && key.toLowerCase().indexOf('leave') !== -1)
|
||||
|
Loading…
Reference in New Issue
Block a user