Commit 89d743b6 by 李伟康

commit 提交

1 parent d41922a7
......@@ -4,12 +4,11 @@
class="container zoom-pan-container"
@touchstart="handleTouchStart"
@touchmove="handleTouchMove"
@touchEnd="handleTouchEnd"
>
<movable-view
class="content"
:style="{ transform: transformStyle ,
'transform-origin': transformOriginStyle
}"
:style="{'transform-origin': transformOriginStyle}"
scale
:direction="scale == 1?'none':'all'"
:scale-min="scaleMin"
......@@ -17,6 +16,7 @@
:disabled="disabled"
out-of-bounds
@scale="onScale"
:scale-value="defalutscale"
>
<slot name="content"></slot>
</movable-view>
......@@ -44,16 +44,19 @@ export default {
data () {
return {
scale: 1,
defalutscale: 1,
isScaling: false,
transformStyle: '',
transformOriginStyle: '50% 50%'
};
},
watch: {
watchScaleValue () {
this.defalutscale = 2
this.scale = 1
this.transformStyle = `scale(1) translate(0px, 0px)`
this.transformOriginStyle = `50% 50%'`
setTimeout(() => {
this.defalutscale = 1
}, 100)
}
},
computed: {
......@@ -73,6 +76,9 @@ export default {
this.transformOriginStyle = `${center.x}px ${center.y}px`;
}
}, 16),
handleTouchEnd () {
this.isScaling = false
},
onScale (e) {
this.scale = e.detail.scale
this.$emit('scale', e.detail)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!