一对一免费咨询:189-6833-3365

作者:Happy__EveryDay,来自授权实现类似于Android的Toast提示效果图:index。宁波小程序开发对于用户来说,能够节约使用时间成本和手机内存空间;对于开发者来说也能节约开发和推广成本。js:var timer; var inputinfo = quot; quot, var app = getApp() Page({ data: { animationData: quot; quot;, showModalStatus:false }, onLoad 。。
作者:Happy__EveryDay,来自授权

实现类似于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("准备执行");
   timer = setTimeOUT(出局)(function () {
   if(this。data。showModalStatus){
  
  this。宁波微信小程序开发其中,通过公众号关联,用户可以实现公众号与小程序之间相互跳转。小程序体现了“用完即走”的理念,用户不用关心是否安装太多应用的问题。应用将无处不在,随时可用,但又无需安装卸载。 hideModal();
  
  console。log("是否执行");
  }
   }。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。宁波小程序开发对于开发者而言,小程序开发门槛相对较低,难度不及APP,能够满足简单的基础应用,适合生活服务类线下商铺以及非刚需低频应用的转换。export(),
   showModalStatus: false
  })
   }。bind(this), 200)
  }, })
index。wxml:
lt;button type="default" bindtap="clickbtn" gt;
  点击 lt;/button gt; lt;view bindtap="hideModal" wx:if="{{showModalStatus}}" gt; lt;/view gt; lt;view animation="{{animationData}}" wx:if="{{showModalStatus}}" gt; lt;!--对话框标题-- gt;
   lt;view gt;
   lt;view gt;
  要显示的网站内容
   lt;/view gt;
   lt;/view gt; lt;/view gt;
源码(source code)下载链接:toastTestNew。rar

© 2008-2019 浙江东美 ALL RIGHTS RESERVED. XMLBAIDU

免责申明:部分内容来自互联网,若侵犯了您的权益,请告知我们删除!

浙ICP备19019195号-1
找网站建设公司就上东美!
189-6833-3365
tel+86-189-6833-3365