最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

微信小程序 Toast自定義實(shí)例詳解

 更新時間:2017年01月20日 17:04:57   投稿:lqh  
這篇文章主要介紹了微信小程序 Toast自定義實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下

微信小程序 Toast自定義實(shí)例詳解

實(shí)現(xiàn)類似于Android的Toast提示 

index.js:

var timer; 
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(200).step() 
  this.setData({ 
   animationData: animation.export(), 
   showModalStatus: true 
  }) 
  setTimeout(function () { 
   animation.translateY(0).step() 
   this.setData({ 
    animationData: animation.export() 
   }) 
  }.bind(this), 200) 
  console.log("準(zhǔn)備執(zhí)行"); 
   timer = setTimeout(function () { 
    if(this.data.showModalStatus){ 
     this.hideModal(); 
     console.log("是否執(zhí)行"); 
   } 
  }.bind(this), 3000) 
 }, 
 clickbtn:function(){ 
  if(this.data.showModalStatus){ 
   this.hideModal(); 
  }else{ 
   this.showModal(); 
  } 
 }, 
 hideModal: function () { 
  if(timer != null){ 
   clearTimeout(timer); 
   timer = null; 
  } 
  // 隱藏遮罩層 
  var animation = wx.createAnimation({ 
   duration: 200, 
   timingFunction: "linear", 
   delay: 0 
  }) 
  this.animation = animation 
  animation.translateY(200).step() 
  this.setData({ 
   animationData: animation.export(), 
  }) 
  setTimeout(function () { 
   animation.translateY(0).step() 
   this.setData({ 
    animationData: animation.export(), 
    showModalStatus: false 
   }) 
  }.bind(this), 200) 
 }, 
}) 

index.wxml:

<button type="default" bindtap="clickbtn"> 
 點(diǎn)擊 
</button> 
<view class="commodity_screen" bindtap="hideModal" wx:if="{{showModalStatus}}"></view> 
<view animation="{{animationData}}" class="commodity_attr_box" wx:if="{{showModalStatus}}"> 
<!--對話框標(biāo)題--> 
 <view class="title-view"> 
  <view class="toast-view"> 
   要顯示的內(nèi)容 
  </view> 
   
 </view> 
</view> 

效果圖:

源碼下載鏈接:http://xiazai.jb51.net/201701/yuanma/toastTestNew(jb51.net).rar

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

相關(guān)文章

  • JS前端繪圖canvas模糊問題示例高清圖解

    JS前端繪圖canvas模糊問題示例高清圖解

    這篇文章主要為大家介紹了JS前端繪圖canvas模糊問題示例高清圖解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-08-08
  • 微信小程序 數(shù)組(增,刪,改,查)等操作實(shí)例詳解

    微信小程序 數(shù)組(增,刪,改,查)等操作實(shí)例詳解

    這篇文章主要介紹了微信小程序 數(shù)組(增,刪,改,查)等操作實(shí)例詳解的相關(guān)資料,這里對小程序的數(shù)組進(jìn)行操作,簡單實(shí)例,需要的朋友可以參考下
    2017-01-01
  • 微信小程序 監(jiān)聽手勢滑動切換頁面實(shí)例詳解

    微信小程序 監(jiān)聽手勢滑動切換頁面實(shí)例詳解

    這篇文章主要介紹了微信小程序 監(jiān)聽手勢滑動切換頁面實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下
    2017-06-06
  • Express框架兩個內(nèi)置中間件方法詳解

    Express框架兩個內(nèi)置中間件方法詳解

    這篇文章主要為大家介紹了Express框架兩個內(nèi)置中間件方法詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-03-03
  • 前端Website?sitemap.xml文件搜索引擎優(yōu)化

    前端Website?sitemap.xml文件搜索引擎優(yōu)化

    這篇文章主要為大家介紹了前端Website的sitemap.xml文件和搜索引擎優(yōu)化實(shí)現(xiàn)詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-05-05
  • Js原型鏈constructor prototype __proto__屬性實(shí)例詳解

    Js原型鏈constructor prototype __proto__屬性實(shí)例詳解

    這篇文章主要介紹了Js原型鏈constructor prototype __proto__屬性實(shí)例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-10-10
  • window屬性onbeforeunload語法教程示例

    window屬性onbeforeunload語法教程示例

    這篇文章主要為大家介紹了window屬性onbeforeunload語法教程示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-07-07
  • JS前端中的設(shè)計模式和使用場景示例詳解

    JS前端中的設(shè)計模式和使用場景示例詳解

    這篇文章主要為大家介紹了JS前端中的設(shè)計模式和使用場景示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-08-08
  • 讓chatGPT教你如何使用taro創(chuàng)建mbox

    讓chatGPT教你如何使用taro創(chuàng)建mbox

    這篇文章主要為大家介紹了讓chatGPT教你如何使用taro創(chuàng)建mbox實(shí)現(xiàn)實(shí)例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-03-03
  • JavaScript中isPrototypeOf函數(shù)

    JavaScript中isPrototypeOf函數(shù)

    這篇文章主要介紹了JavaScript中isPrototypeOf函數(shù),isPrototypeOf() 是 Object函數(shù)(類)的下的一個方法,用于判斷當(dāng)前對象是否為另外一個對象的原型,如果是就返回 true,否則就返回 false,下面來看看詳細(xì)內(nèi)容,需要的朋友可以參考一下
    2021-11-11

最新評論

凤山市| 邛崃市| 河间市| 湖南省| 海门市| 辽阳县| 科尔| 西和县| 阿克苏市| 兰考县| 五原县| 大关县| 修武县| 南华县| 遂昌县| 徐州市| 眉山市| 涞水县| 湖北省| 白银市| 蓬莱市| 丹寨县| 兴和县| 辽中县| 临漳县| 台安县| 宣城市| 连云港市| 屯昌县| 比如县| 黔西县| 昭通市| 佛坪县| 石泉县| 伊川县| 淳安县| 台湾省| 普定县| 景德镇市| 外汇| 娱乐|