Merge pull request #2633 from homerjam/fix-route-transitions-example

fix route transitions example
This commit is contained in:
Sébastien Chopin 2018-01-26 12:23:50 +01:00 committed by GitHub
commit 3235b037a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,11 @@
import axios from 'axios' import axios from 'axios'
export default { export default {
// Watch for $route.query.page to call Component methods (asyncData, fetch, validate, layout, etc.)
watchQuery: ['page'],
// Key for <nuxt-child> (transitions)
key: (to) => to.fullPath,
// Called to know which transition to apply
transition(to, from) { transition(to, from) {
if (!from) return 'slide-left' if (!from) return 'slide-left'
return +to.query.page < +from.query.page ? 'slide-right' : 'slide-left' return +to.query.page < +from.query.page ? 'slide-right' : 'slide-left'