在小游戏中,会有如下图的提示窗口,这些可以使用微信提供的交互接口实现。

 

微信小游戏 交互接口的使用 wx.showToast wx.showLoading

 

微信小游戏 交互接口的使用 wx.showToast wx.showLoading

 

使用loading等待的接口。mask=true表示遮罩,防止等待时点击其他按钮触发其他操作导致异常。

wx.showLoading({title:"生成图片中",mask:true,
        success:(res)=>{
            console.log("success:",res);
        },
        fail:(res)=>{
            console.log("fail:",res);
        }});

  

使用消息提示框,duration是消息显示1000ms后消失。

wx.showToast({title:"保存成功", icon:"", image:"",duration:1000,
        success:(res)=>{
            console.log("success:",res);
        },
        fail:(res)=>{
            console.log("fail:",res);
        }});

  

 

相关文章:

  • 2021-12-20
  • 2021-08-21
  • 2021-05-11
  • 2021-04-10
  • 2022-12-23
  • 2022-01-09
  • 2021-04-29
  • 2022-01-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2021-11-01
  • 2021-09-18
  • 2021-07-05
  • 2021-06-07
相关资源
相似解决方案