微信小程序移动拖拽视图-movable-view实例详解
更新时间:2019年08月17日 08:43:17 作者:北京智慧流官方iOS博客
这篇文章主要介绍了微信小程序移动拖拽视图-movable-view的实例代码,代码简单易懂,非常不错,具有一定的参考借鉴价值,需要的朋友可以参考下
JS中的sender参数(sender是事件的传值)前提是只有一个touch移动的时候。多个touch需要在
changedTouches
数组中查找
redclcik:function(sender){
wx.showModal({
title: '点击红色',
content: '',
})
console.log(sender);
},
redmove:function(sender){
console.log(sender);
// console.log(sender.changedTouches[0].pageX);
},
.wxss内容:
<view>移动视图控件</view> <!-- 创建一个move-area --> <movable-area style="width:100%;height:1000rpx;background:gray;"> <!-- 可以移动view 黄色、宽高100rpx--> <movable-view style='background:yellow;width:100rpx;height:100rpx;' direction="all"> </movable-view> <!-- 可以移动view 红色、宽高100rpx--> <movable-view style='background:red;width:100rpx;height:100rpx;' direction="all" bindtap='redclcik' bindtouchmove='redmove'> </movable-view> </movable-area>
视图效果:

总结
以上所述是小编给大家介绍的微信小程序移动拖拽视图-movable-view实例详解,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!
相关文章
JavaScript使用Base64编码和Blob对象加密图像url地址
有时候会看到一些网站的图片src中是blob:http://example.com/7c672acb-375c-4a26-9af9-99cb4c77f04d,这样的图片加载怎么实现呢?本文讲解在浏览器中JavaScript使用解析Base64编码和Blob对象技术来实现,下面是实现的步骤和相应的示例代码,2023-12-12


最新评论