|
楼主 |
发表于 2022-9-24 16:38:04
|
显示全部楼层
上面的第二段代码不知道为什么写不进去,我写在这里
- leaveHandel(e) {
- this.todoListData[this.dealWithItemIndex].isShow = true
- },
- beforeEnterHandel(e) {
- console.log('动画开始');
- if (!this.todoListData[this.dealWithItemIndex]?.status) {
- e.style.backgroundColor = '#fff'
- e.style.transition = 'all 0s linear'
- } else { // true
- e.style.backgroundColor = '#fe7345' // 生效
- e.style.transition = 'all .5s linear'
- }
- },
- enterHandel(e, done) {
- if (this.todoListData[this.dealWithItemIndex]?.status) { // true
- let step = 0
- console.log(step); // 能打印 0
- e.ontransitionend = function () { // 不能进入监听
- console.log(111); // 不打印111
- step++
- if (step == 1) {
- e.style.transform = 'rotate3d(1,0,0,45deg)'
- e.style.transition = 'all .5s linear'
- } else if (step == 2) {
- e.style.transform = 'rotate3d(1,0,0,0deg)'
- e.style.transition = 'all .5s linear'
- } else {
- done()
- }
- // }
- }
- // 改变样式
- e.style.backgroundColor = 'green' // 生效
- e.style.transition = 'all .5s linear'
- console.log(e,e.ontransitionend);
- console.log('动画进行中'); // 正常打印
- }else{
- done()
- }
- },
- afterEnterHandel(e) {
- console.log('动画结束了'); // 正常打印
- e.ontransitionend = null
- }
复制代码 |
|