12345678910111213141516171819202122232425262728293031 |
- Component({
- data: {
- top: "550px",
- left: "345px",
- viewHeight: null
- },
- lifetimes: {
- attached: function () {
- let that = this;
- wx.getSystemInfo({
- success: (res => that.setData({
- viewHeight: res.windowHeight
- }))
- });
- },
- },
- methods: {
- viewTouchMove(e) {
- let left = e.touches[0].pageX;
- if (left > 375) left = 375;
- if (left < 0) left = 0;
- let top = e.touches[0].pageY;
- if (top < 0) top = 0;
- if (top > this.data.viewHeight) top = this.data.viewHeight;
- this.setData({
- left: left + 'px',
- top: top + 'px'
- })
- }
- }
- })
|