时间:2021-07-01 10:21:17 帮助过:137人阅读
本文实例讲述了微信小程序实现鼠标拖动效果。分享给大家供大家参考,具体如下:
关键代码
index.wxml文件
- <view class="view"
- style="left:{{left}}px;top:{{top}}px;"
- bindtouchmove="viewTouchMove"
- >使用鼠标拖动我</view>
index.js文件
- Page({
- data:{
- left:'',
- top:''
- },
- viewTouchMove:function(e){
- this.setData({
- left:e.touches[0].clientX-60,
- top:e.touches[0].clientY-60
- })
- }
- })
上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:
在Angular中如何使用toDoList
在vue中有关eventbus的详细解读
使用微信小程序如何实现图片选择区域裁剪
使用Javascript如何获取选择文本所在的句子
以上就是在微信小程序中如何实现鼠标拖动的详细内容,更多请关注Gxl网其它相关文章!