// index.js
// 获取应用实例
const app = getApp()
Page({
data: {
left:0,
top:0,
},
// 事件处理函数
ClickEvent:function(){
console.log("图片被点击了")
},
MoveEvent:function(e){
console.log("图片被拖动了")
console.log("X:"+e.touches[0].pageX)
console.log("Y:"+e.touches[0].pageY)
//获取屏幕尺寸
var windowHeight = wx.getSystemInfoSync().windowHeight;
var windowWidth = wx.getSystemInfoSync().windowWidth;
if (e.touches[0].pageY < 0){
e.touches[0].pageY = 0;
}
if (e.touches[0].pageY > windowHight-120){
e.touches[0].pageY = windowHeight-120;
}
if(e.touches[0].pageX <0){
e.touches[0].pageX = 0;
}
if(e.touches[0].pageX > windowWidth-120){
e.touches[0].pageX =windowWidth-120;
}
this.setData({
left:e.touches[0].pageX,
top:e.touches[0].pageY
})
},
// 事件处理函数
bindViewTap() {
wx.navigateTo({
url: '../logs/logs'
})
},
getUserInfo: function(e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
}
})
你打错了 windowHight
windowHeight 和 windowHight 学会复制粘贴吧,别手打
[捂脸]