在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ 微信小程序,多個(gè)view綁定相同點(diǎn)擊事件,如何綁定當(dāng)前view

微信小程序,多個(gè)view綁定相同點(diǎn)擊事件,如何綁定當(dāng)前view

clipboard.png

clipboard.png

如圖所示兩個(gè)欄目分別彈出不同的的從底部彈出的彈層 怎么定位當(dāng)前的view對應(yīng)的彈層呢

<view class='item'>
<view bindtap="showModal">已選擇</view>
<view class="mask" bindtap="hideModal" wx:if="{{ModalStatus}}"></view>
<view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{ModalStatus}}">
  <view class='product_info box-center-v border'>規(guī)格彈出層</view>
</view>
</view>
<view class='item'>
<view bindtap="showModal">配送至</view>
<view class="mask" bindtap="hideModal" wx:if="{{ModalStatus}}"></view>
<view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{ModalStatus}}">
  <view class='product_info box-center-v border'>地址彈出層</view>
</view>
</view>
showModal: function () {
    // 顯示遮罩層
    var animation = wx.createAnimation({
      duration:300,
      timingFunction: "ease",
      delay: 0,
    })
    this.animation = animation
    animation.translateY(600).step()
    this.setData({
      animationData: animation.export(),
      ModalStatus: true
    })
    setTimeout(function () {
      animation.translateY(0).step()
      this.setData({
        animationData: animation.export()
      })
    }.bind(this), 200)
  },
  //隱藏對話框
  hideModal: function () {
    // 隱藏遮罩層
    var animation = wx.createAnimation({
      duration: 200,
      timingFunction: "linear",
      delay: 0
    })
    this.animation = animation
    animation.translateY(400).step()
    this.setData({
      animationData: animation.export(),
    })
    setTimeout(function () {
      animation.translateY(0).step()
      this.setData({
        animationData: animation.export(),
        ModalStatus: false
      })
    }.bind(this), 200)
  }
回答
編輯回答
萌面人

你是想知道現(xiàn)在彈起的是哪個(gè)view嗎?那你為何不設(shè)個(gè)變量,存當(dāng)前彈窗的隊(duì)列,最后一個(gè)就永遠(yuǎn)是最上面的,多彈窗設(shè)計(jì)下的管理方案。

2017年6月24日 23:27
編輯回答
悶騷型

可以傳個(gè)值給點(diǎn)擊事件:

<view class="mask" data-index='one' bindtap="hideModal" wx:if="{{ModalStatus}}"></view>


hideModal:(e)=>{
    let index=e.datail.index;
    ///dome somethings... 
}
2017年2月2日 15:32