html部分
<template>
<view>
<button
@touchmove = "buttonMove"
@touchstart = "buttonStart"
@touchend="buttonEnd"
:style="{
top: buttonTop + 'px',
left: buttonLeft + 'px',
width: '50px',
height: '50px',
borderRadius:'50px',
position: 'fixed',
background: '#41A863',
lineHeight:'30px',
fontSize:'25pt',
color:'#fff'}">
+
</button>
</view>
</template>
js部分
<script>
data() {
return {
buttonTop: 60,
buttonLeft: 20,
windowHeight: '',
windowWidth: '',
startPoint:null
}
},
onShow() {
let that = this;
wx.getSystemInfo({
success: function (res) {
// 屏幕宽度、高度 单位为px
that.windowHeight = res.win