收藏
回答

mpvue框架 movable-view小程序组件bindchange事件拖拉会出现死循环问题?

    <movable-area class="movableArea" v-if="suspension&&isSuspension">

        <movable-view  :x="moveX" :y="moveY" @change.stop="moveChangeAction" direction="all" damping="60" class="movableView">

          <div>

            <img class="template_suspension_img" v-if="suspension.suspension_img_url" :src="suspension.suspension_img_url" alt="" @click.stop="skipRedPacketAction()">

            <img class="template_suspension_close" v-if="suspension.suspension_img_url" src="/static/images/index_adv_close2.png" alt="" @click.stop="closeRedPacketAction()">

          </div>

        </movable-view>

    </movable-area>


 // 红包悬浮按钮 

    moveChangeAction(e){

      console.log('红包悬浮按钮');

      console.log(e.mp.detail);

      let getSysInfo = wx.getStorageSync("phoneMobile");

      let ratio = getSysInfo.windowWidth/375;

      let phoneCenter = getSysInfo.windowWidth / 2 - (60*ratio);

      console.log(phoneCenter);

      if(e.mp.detail.x!=0 || e.mp.detail.x!=getSysInfo.windowWidth-(180*ratio)) {

        if(e.mp.detail.x<phoneCenter) {

          this.moveX = 0;

          this.moveY = e.mp.detail.y;

        }else {

          this.moveX = (750-180)*ratio;

          this.moveY = e.mp.detail.y;

        }

      }

    },

最后一次编辑于  2020-04-26
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容
问题标签