xcx/components/swipe-action/swipe-action.js

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*
* touch事件判断方式
*/
function swipeDirection(x1, x2, y1, y2) {
  return Math.abs(x1 - x2) >=
    Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down')
}

Component({
  properties: {
    actions: {
      value: [],
      type: Array,
      observer: 'updateButtonSize'
    },
    unclosable: {
      value: false,
      type: Boolean
    },
    toggle: {
      value: false,
      type: Boolean,
      observer: 'closeButtonGroup'
    },
    operateWidth: {
      type: Number,
      value: 160
    },
    params:{
      type:Object,
      value:{}
    }
  },
  options: {
    // 在组件定义时的选项中启用多slot支持
    multipleSlots: true
  },
  data: {
    //touch start position
    tStart: {
      pageX: 0,
      pageY: 0
    },
    //限制滑动距离
    limitMove: 0,
    //element move position
    position: {
      pageX: 0,
      pageY: 0
    },
    isShowBtn:false
  },
  methods: {
    //阻止事件冒泡
    loop() { },
     updateButtonSize() {
      const actions = this.data.actions;
      if (actions.length > 0) {
        const query = wx.createSelectorQuery().in(this);
        let limitMovePosition = 0;
后面还有 93 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。