小程序----弹框

<button type="default" bindtap='toastClick'>弹出Toast</button>
<button type="default" bindtap='modelClick'>弹出Model</button>

1.Toast

toastClick:function(){
    wx.showToast({
      title: '成功',
      icon:"success",
      duration:2000
    });
    setTimeout(function(){
      wx.hideToast()
    },1000);
  }

2.Model

modelClick:function(){
    wx.showModal({
      title: '提示',
      content: '你好,你已经成功设置了这个控件',
      success:function(res){
        if(res.confirm){
          console.log("确定");
        }
        else{
          console.log("取消");
        }
      }
    })
  },

猜你喜欢

转载自blog.csdn.net/scwMason/article/details/82818943
今日推荐