小程式拖拽元件
阿新 • • 發佈:2018-12-19
<movable-area style="height: {{H*2}}rpx;width: {{W*2}}rpx; position: fixed; top: 0;"> <movable-view direction="all" style="height: 100rpx; width: 100rpx; text-align: center; line-height: 100rpx; background: yellow;" x="{{x}}" y="{{y}}"> <text class='iconfont icon-del'></text> </movable-view> </movable-area>
page({
data: {
x: 200,
y: 300,
},
onLoad() {
this.setData({
W: wx.getSystemInfoSync().windowWidth, // 獲取當前視窗的寬度
H: wx.getSystemInfoSync().windowHeight // 獲取當前視窗的高度
})
}
})