Component({
  properties: {
    radius: {
      type: Number
    }, //半径 单位px
    useSlot: {
      type: Boolean
    }
  },
  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 - this.data.radius)) left = 375 - (this.data.radius / 2);
      if (left < 0 + this.data.radius) left = 0 + this.data.radius;
      let top = e.touches[0].pageY;
      if (top < 0 + this.data.radius) top = 0 + this.data.radius;
      if (top > this.data.viewHeight - this.data.radius) top = this.data.viewHeight - this.data.radius;
      this.setData({
        left: left + 'px',
        top: top + 'px'
      })
    }
  }
})