你好 多个movable-view删除会出现位置变化,按顺序删除就不会,不按顺序就出错?
发布于 5 年前 作者 taocao 539 次浏览 来自 问答

你好 多个movable-view删除会出现位置变化,按顺序删除就不会,不按顺序就出错?

//wxml

movable-areastyle"height: 500px; width: 375px; background: pink;overflow: hidden;"scale-area
  movable-viewdata-index"{{index}}"bindtouchstart"bindtouchstart"style"width:100px;height:100px;background-image:url('{{item}}');"wx:for"{{list}}"direction"all"scalescale-min"0.5"scale-max"10"
  </movable-view
</movable-area
buttonbindtap"re"删除</button

// js

  data
    list
      "https://edanwenhua.oss-cn-beijing.aliyuncs.com/headimg/c670ffe098cab3485370a851567d0026f4ea4db8.png?x-oss-process=image/resize,m_lfit,h_200,w_200
      "https://edanwenhua.oss-cn-beijing.aliyuncs.com/headimg/52c56086fa76beb9bda3e4800a4cdaa3577df1df.png?x-oss-process=image/resize,m_lfit,h_200,w_200
      "https://edanwenhua.oss-cn-beijing.aliyuncs.com/headimg/fe42b3a1a4219a248eeb143776da29b2128ad5d2.png?x-oss-process=image/resize,m_lfit,h_200,w_200
      "https://edanwenhua.oss-cn-beijing.aliyuncs.com/headimg/d286fe0e65fd1e702c535711c0f1eaa40f42ec61.png?x-oss-process=image/resize,m_lfit,h_200,w_200
      "https://edanwenhua.oss-cn-beijing.aliyuncs.com/headimg/70de3dd27f6db5eb1901c3959ebfb33d684416bd.png?x-oss-process=image/resize,m_lfit,h_200,w_200
    ],
    index
  },

  re() {
   const that = this
    let res = that.data.list
    res.splice(that.data.index, 1)
    that.setData({
      list: res
    })
  },

回到顶部