Created
May 23, 2018 09:57
-
-
Save rigor789/934e6f889ae08b88e86de2adc56b8251 to your computer and use it in GitHub Desktop.
NSVue js transition hooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
methods: { | |
beforeEnter(el) { | |
el.setAttribute('translateY', -200); | |
}, | |
enter(el, done) { | |
el.nativeView | |
.animate({ | |
translate: { | |
x: 0, | |
y: 0, | |
}, | |
duration: 200, | |
curve: AnimationCurve.ease, | |
}) | |
.then(done); | |
}, | |
afterEnter(el) { | |
// | |
}, | |
beforeLeave() { | |
if (this.$refs.searchField) { | |
this.$refs.searchField.nativeView.dismissSoftInput(); | |
} | |
}, | |
async leave(el, done) { | |
el.nativeView | |
.animate({ | |
translate: { | |
x: 0, | |
y: -200, | |
}, | |
duration: 100, | |
curve: AnimationCurve.ease, | |
}) | |
.then(done); | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<transition | |
mode="out-in" | |
@before-enter="beforeEnter" | |
@enter="enter" | |
@after-enter="afterEnter" | |
@before-leave="beforeLeave" | |
@leave="leave" | |
:css="false"> | |
<GridLayout key="a" v-if="searching" columns="*"> | |
... | |
</GridLayout> | |
<GridLayout key="b" v-else columns="*"> | |
... | |
</GridLayout> | |
</transition> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment