|
@ -1,6 +1,6 @@ |
|
|
<template> |
|
|
<template> |
|
|
<view> |
|
|
<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> |
|
|
<image src="@/static/icons_ui/icon_scan_white.svg"></image> |
|
|
<view>扫描</view> |
|
|
<view>扫描</view> |
|
|
</view> |
|
|
</view> |
|
@ -19,7 +19,9 @@ |
|
|
old: { |
|
|
old: { |
|
|
x: 0, |
|
|
x: 0, |
|
|
y: 0 |
|
|
y: 0 |
|
|
} |
|
|
}, |
|
|
|
|
|
btnX:20, |
|
|
|
|
|
btnY:20, |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
props: { |
|
|
props: { |
|
@ -30,6 +32,16 @@ |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
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) { |
|
|
goScan(content) { |
|
|
this.$emit("goScan", ''); |
|
|
this.$emit("goScan", ''); |
|
|
}, |
|
|
}, |
|
|