Commit 89d743b6 by 李伟康

commit 提交

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