前端ll
前端ll
  • 发布:2021-07-03 12:56
  • 更新:2021-07-03 12:56
  • 阅读:446

父级有定位position:fixed时,uni.requireNativePlugin('animation')动画会多出一个当前节点,BindingX也是一样的现象

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: windows 10 专业版

HBuilderX类型: 正式

HBuilderX版本号: 3.1.18

手机系统: 全部

页面类型: nvue

打包方式: 云端

项目创建方式: HBuilderX

测试过的手机:

设备名称:HONOR 20 PRO [attach]75811[/attach] 型号:YAL-AL10 Android版本:10

示例代码:

···
<template>
<view class="box">
<view ref="test" @click="move" class="box-item"></view>
</view>
</template>
<script>
const animation = uni.requireNativePlugin('animation')
export default {
methods: {
move() {
var testEl = this.$refs.test;
animation.transition(testEl, {
styles: {
backgroundColor: '#007AFF',
transform: 'translate(100px, 80px)',
transformOrigin: 'center center'
},
duration: 800, //ms
timingFunction: 'ease',
delay: 0 //ms
},()=>{
uni.showToast({
title: 'finished',
icon:'none'
});
})
}
}
}
</script>
<style scoped>
.box{
width:750rpx;
height:750rpx;
position:fixed;
}
.box-item{
width: 250rpx;
height: 250rpx;
background-color: #00aaff;
}
</style>
···

操作步骤:

···
<template>
<view class="box">
<view ref="test" @click="move" class="box-item"></view>
</view>
</template>
<script>
const animation = uni.requireNativePlugin('animation')
export default {
methods: {
move() {
var testEl = this.$refs.test;
animation.transition(testEl, {
styles: {
backgroundColor: '#007AFF',
transform: 'translate(100px, 80px)',
transformOrigin: 'center center'
},
duration: 800, //ms
timingFunction: 'ease',
delay: 0 //ms
},()=>{
uni.showToast({
title: 'finished',
icon:'none'
});
})
}
}
}
</script>
<style scoped>
.box{
width:750rpx;
height:750rpx;
position:fixed;
}
.box-item{
width: 250rpx;
height: 250rpx;
background-color: #00aaff;
}
</style>
···

预期结果:

不希望多出节点

实际结果:

多一个节点

bug描述:

父级有position:absolute时,动画失效、
父级有position:fixed时,会多出一个节点

2021-07-03 12:56 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复