|
|
@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<view> |
|
|
|
<view class="scan_float" @click="goScan('bottom')"> |
|
|
|
<view class="scan_float" ref="scanRef" @click="goScan('bottom')" @touchstart.prevent="handleTouchStart" @touchmove.prevent="handleTouchMove"> |
|
|
|
<image src="@/static/icons_ui/icon_scan_white.svg"></image> |
|
|
|
<view>扫描</view> |
|
|
|
</view> |
|
|
@ -19,7 +19,9 @@ |
|
|
|
old: { |
|
|
|
x: 0, |
|
|
|
y: 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
btnX:20, |
|
|
|
btnY:20, |
|
|
|
} |
|
|
|
}, |
|
|
|
props: { |
|
|
@ -30,6 +32,16 @@ |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
handleTouchStart(e) { |
|
|
|
this.btnX = e.changedTouches[0].clientX-e.currentTarget.offsetLeft |
|
|
|
this.btnY = e.changedTouches[0].clientY-e.currentTarget.offsetTop |
|
|
|
}, |
|
|
|
handleTouchMove(e) { |
|
|
|
console.log("handleTouchMove",e); |
|
|
|
this.$refs.scanRef.$el.style.left = e.changedTouches[0].clientX-this.btnX+'px' |
|
|
|
this.$refs.scanRef.$el.style.top = e.changedTouches[0].clientY-this.btnY+'px' |
|
|
|
}, |
|
|
|
|
|
|
|
goScan(content) { |
|
|
|
this.$emit("goScan", ''); |
|
|
|
}, |
|
|
|