国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

微信小程序 自定義對話框實例詳解

2019-11-19 17:50:39
字體:
來源:轉載
供稿:網友

微信小程序 自定義對話框實例詳解

效果圖:


index.wxml:

<button type="default" bindtap="clickbtn">  點擊 </button> <view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view> <view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{showModalStatus}}"> <!--對話框標題--> <view class="dialog-title">  請輸入內容 </view> <!--對話框輸入部分--> <view class="input-view">  <input type="text" bindblur="input_content" class="input-style"/> </view> <!--對話框按鈕--> <view class="line-top">  </view> <view class="btn-view">  <view class="btn-cancel" bindtap="click_cancel">       取 消  </view>  <view class="btn-line">  </view>  <view class="btn-cancel" bindtap="click_ok">       確 定  </view> </view> </view> 

index.js:

var inputinfo = ""; var app = getApp() Page({  data: {   animationData:"",   showModalStatus:false  },    onLoad: function () {     },  showModal: function () {   // 顯示遮罩層   var animation = wx.createAnimation({    duration: 200,    timingFunction: "linear",    delay: 0   })   this.animation = animation   animation.translateY(300).step()   this.setData({    animationData: animation.export(),    showModalStatus: true   })   setTimeout(function () {    animation.translateY(0).step()    this.setData({     animationData: animation.export()    })   }.bind(this), 200)  },  clickbtn:function(){   if(this.data.showModalStatus){    this.hideModal();   }else{    this.showModal();   }  },  hideModal: function () {   // 隱藏遮罩層   var animation = wx.createAnimation({    duration: 200,    timingFunction: "linear",    delay: 0   })   this.animation = animation   animation.translateY(300).step()   this.setData({    animationData: animation.export(),   })   setTimeout(function () {    animation.translateY(0).step()    this.setData({     animationData: animation.export(),     showModalStatus: false    })   }.bind(this), 200)  },  click_cancel:function(){   console.log("點擊取消");    this.hideModal();  },  click_ok:function(){   console.log("點擊了確定===,輸入的信息為為==",inputinfo);    this.hideModal();  },  input_content:function(e){   console.log(e);   inputinfo = e.detail.value;   }  }) 

源碼下載:http://xiazai.VeVB.COm/201701/yuanma/modalTest(VeVB.COm).rar

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 崇信县| 大余县| 阿勒泰市| 昂仁县| 伊吾县| 浑源县| 苍溪县| 贵溪市| 平乐县| 和硕县| 新巴尔虎左旗| 赣榆县| 莱西市| 桓台县| 龙川县| 阳新县| 福建省| 北京市| 璧山县| 克山县| 广南县| 余姚市| 仁寿县| 河西区| 介休市| 句容市| 武山县| 凤庆县| 全州县| 利辛县| 张家界市| 乐山市| 资溪县| 江油市| 卢氏县| 珲春市| 沂源县| 珲春市| 沂源县| 乌拉特中旗| 桂平市|