加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

微信小程序开发图片拖拽实例详解

发布时间:2020-12-14 20:17:18 所属栏目:资源 来源:网络整理
导读:微信小程序开发图片拖拽实例详解 1.编写页面结构:moveimg.wxml 2.编写页面样式:moveimg.wxss 3.设置数据:moveimg.js },ballMoveEvent: function(e) { var touchs = e.touches[0]; var pageX = touchs.pageX; console.log('宽度 '+this.data.screenWidth) co

微信小程序开发图片拖拽实例详解

1.编写页面结构:moveimg.wxml

2.编写页面样式:moveimg.wxss

3.设置数据:moveimg.js

},ballMoveEvent: function(e) {
var touchs = e.touches[0];
var pageX = touchs.pageX;
console.log('宽度 '+this.data.screenWidth)
console.log('pageX: ' + pageX);
//这里用right和bottom.所以需要将pageX pageY转换
var x = this.data.screenWidth/2 - pageX-20;
if(this.data.screenWidth>385){
if(x>42){x=42;}
}else{
if(x>32){x=32;}
}
if(x<0){x=0;}
console.log('x:' + x)
this.setData({
ballleft: -x
});
}
})

这几天一直在研究图片裁剪,思路是有,可是却遇到各种问题。可怜编程不易啊。

想了好久,决定还是简单开始吧。如果大家有更好的方式或是其他想法,欢迎提出,一起讨论。

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读