提交 27b2f4ee 编写于 作者: 郭胜强

fix: 解决resize-sensor组件第一次事件观测实效的问题

上级 83718ec9
......@@ -10,8 +10,8 @@ export default {
data: function () {
return {
size: {
width: 0,
height: 0
width: -1,
height: -1
}
}
},
......@@ -19,15 +19,10 @@ export default {
size: {
deep: true,
handler: function (size) {
this.reset()
this.$emit('resize', Object.assign({}, size))
}
}
},
beforeDestroy: function () {
this.$emit('resize', { width: 0, height: 0 })
this.$emit('resizeSensorBeforeDestroy')
},
mounted: function () {
if (this.initial === true) {
this.$nextTick(this.update)
......@@ -65,6 +60,7 @@ export default {
update: function () {
this.size.width = this.$el.offsetWidth
this.size.height = this.$el.offsetHeight
this.reset()
}
},
render: function (create) {
......@@ -94,7 +90,7 @@ export default {
</script>
<style>
@keyframes resizeSensorVisibility {
@keyframes once-show {
from {
top: 0;
}
......@@ -112,7 +108,7 @@ uni-resize-sensor {
display: block;
z-index: -1;
visibility: hidden;
animation-name: resizeSensorVisibility;
animation-name: once-show;
}
uni-resize-sensor > div > div {
position: absolute;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册