小程序弹窗

1.Toast

在这里插入图片描述

  handleShowToast(){
    wx.showToast({
      title: '你好啊',
      duration:3000,
      icon:'none',
      mask:true,
      success(){
        console.log('展示弹窗成功');
      },
      fail(){
        console.log('展示弹窗失败');
      },
      complete(){
        console.log("完成函数的调用");
      }
    })
  },

在这里插入图片描述

2.modal

<!-- modal -->
<button  bindtap="handleShowModal">ShowModal</button>
handleShowModal(){
    wx.showModal({
      title:'确定退出吗',
      content:"我是内容 hahah ",
      cancelColor: 'red',
      confirmColor:'#58bc58',
      success(res){
        // console.log(res);
        if(res.cancel){
          console.log("取消");
        }
        if(res.confirm){
          console.log("确定");
        }
      },
      showCancel:true,
      cancelText:"退出"
    })
  },

在这里插入图片描述

3.loading

<!-- loading -->
<button  bindtap="handleShowLoading">ShowLoading</button>
handleShowLoading(){
    wx.showLoading({
      title: '加载中',
      mask: true,
      success: (res) => {},
      fail: (res) => {},
      complete: (res) => {},
    })
    setTimeout(()=>{
      // 必须手动调用hideLoading才会消失
      wx.hideLoading()
    },2000)
  },

在这里插入图片描述

4.actionSheet

<!-- actionSheet -->
<button  bindtap="handleShowActionSheet">actionSheet</button>
  handleShowActionSheet(){
  wx.showActionSheet({
    itemList: ['相册','拍照'],
    itemColor:'red',
    success(res){
      console.log(res);
    },
    fail(err){
      console.log(err);
      
    }
  })
  },

在这里插入图片描述

5.分享

第一直接按按钮

<!-- 分享按钮 -->
<button open-type="share">分享</button>

第二按右上角

  onShareAppMessage: function () {
    return {
      title:"小程序aaa",
      path:"pages/index/index",
      imageUrl:'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png'
    }
  }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值