mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 10:04:05 +00:00
parent
549b8da21f
commit
647f3db320
@ -14,17 +14,16 @@ let router
|
|||||||
<%= (store ? 'let store' : '') %>
|
<%= (store ? 'let store' : '') %>
|
||||||
|
|
||||||
function mapTransitions(Components, to, from) {
|
function mapTransitions(Components, to, from) {
|
||||||
const resolve = t => (typeof t.options.transition === 'function')
|
const resolveTransitions = component => (typeof component.options.transition === 'function')
|
||||||
? t.options.transition(to, from)
|
? component.options.transition(to, from)
|
||||||
: Object.assign({}, t.options.transition)
|
: component.options.transition
|
||||||
|
|
||||||
const resolveRoute = r => resolve(r.matched[0].components.default)
|
const resolveRoute = route => resolveTransitions(route.matched[0].components.default)
|
||||||
|
|
||||||
return Components.map((Component) => {
|
return Components.map((Component) => {
|
||||||
let transitions = Object.assign({}, to ? resolveRoute(to) : resolve(Component))
|
const transitions = Object.assign({}, to ? resolveRoute(to) : resolveTransitions(Component))
|
||||||
// Combine transitions
|
const from_transitions = from ? resolveRoute(from) : {}
|
||||||
// Prefer leave* transitions of from route
|
// Combine transitions & prefer leave* transitions of from route
|
||||||
let from_transitions = from ? resolveRoute(from) : {}
|
|
||||||
Object.keys(from_transitions).forEach(key=> {
|
Object.keys(from_transitions).forEach(key=> {
|
||||||
if (from_transitions[key] && key.toLowerCase().indexOf('leave') !== -1) {
|
if (from_transitions[key] && key.toLowerCase().indexOf('leave') !== -1) {
|
||||||
transitions[key] = from_transitions[key]
|
transitions[key] = from_transitions[key]
|
||||||
|
Loading…
Reference in New Issue
Block a user