Fix #5842 and refactoring

This commit is contained in:
syuilo
2020-02-06 14:23:01 +09:00
parent 781cebf194
commit 1b88a7bc03
21 changed files with 58 additions and 31 deletions

View File

@ -27,20 +27,42 @@ export default Vue.extend({
type: String,
required: false,
default: 'down'
},
reversed: {
type: Boolean,
required: false,
default: false
}
},
data() {
return {
currentChildren: [] as Node[],
index: 0
};
},
methods: {
updateChildren() {
this.currentChildren = this.$slots.default!.filter(n => n.elm != null).map(n => n.elm!);
},
beforeEnter(el) {
el.style.opacity = 0;
el.style.transform = this.direction === 'down' ? 'translateY(-64px)' : 'translateY(64px)';
},
enter(el, done) {
let index = this.index;
// TODO
//if (this.reversed) index = ...;
//console.log(index);
el.style.transition = [getComputedStyle(el).transition, 'transform 0.7s cubic-bezier(0.23, 1, 0.32, 1)', 'opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1)'].filter(x => x != '').join(',');
setTimeout(() => {
el.style.opacity = 1;
el.style.transform = 'translateY(0px)';
setTimeout(done, 700);
}, this.delay * el.dataset.index)
setTimeout(() => {
done();
this.index--;
}, 700);
}, this.delay * index)
this.index++;
},
leave(el, done) {
setTimeout(() => {