提交 7540059a 编写于 作者: X xzs02

fix: 解决movable-view组件动态显示后异常的问题 #163

上级 246827c5
......@@ -26,12 +26,15 @@ export default {
this.pinchStartLen = null
},
mounted: function () {
this._getWH()
this.items.forEach(function (item, index) {
item.componentInstance.setParent()
})
this._resize()
},
methods: {
_resize () {
this._getWH()
this.items.forEach(function (item, index) {
item.componentInstance.setParent()
})
},
_find (target, items = this.items) {
var root = this.$el
function get (node) {
......@@ -143,11 +146,13 @@ export default {
var ours = this[`_${event}`]
$listeners[event] = existing ? [].concat(existing, ours) : ours
})
return createElement(
'uni-movable-area',
{
on: $listeners
}, items)
return createElement('uni-movable-area', {
on: $listeners
}, [createElement('v-uni-resize-sensor', {
on: {
resize: this._resize
}
}), ...items])
}
}
</script>
......
<template>
<uni-movable-view v-on="$listeners">
<v-uni-resize-sensor @resize="setParent"/>
<slot/>
</uni-movable-view>
</template>
......@@ -216,9 +217,7 @@ export default {
},
mounted: function () {
this.touchtrack(this.$el, '_onTrack')
if (this.$parent._isMounted) {
this.setParent()
}
this.setParent()
this._friction.reconfigure(1, this.frictionNumber)
this._STD.reconfigure(1, 9 * Math.pow(this.dampingNumber, 2) / 40, this.dampingNumber)
this.$el.style.transformOrigin = 'center'
......@@ -460,6 +459,9 @@ export default {
}
},
setParent: function () {
if (!this.$parent._isMounted) {
return
}
if (this._FA) {
this._FA.cancel()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册