【微信小程序】显示自带的弹窗,包括加载中,成功,错误,提示,警告

在微信小程序中,可以使用以下方法来显示自带的弹窗:

  1. 显示加载中的弹窗:
wx.showLoading({
    
    
  title: '加载中',
  mask: true
});
  1. 显示成功的弹窗:
wx.showToast({
    
    
  title: '成功',
  icon: 'success',
  duration: 2000
});
  1. 显示错误的弹窗:
wx.showToast({
    
    
  title: '错误',
  icon: 'none',
  duration: 2000
});
  1. 显示提示的弹窗:
wx.showToast({
    
    
  title: '提示',
  icon: 'none',
  duration: 2000
});
  1. 显示警告的弹窗:
wx.showToast({
    
    
  title: '警告',
  image: '/path/to/warning.png',
  duration: 2000
});

在上述示例中,wx.showLoading()方法用于显示加载中的弹窗,wx.showToast()方法用于显示成功、错误、提示和警告的弹窗。这些方法接受不同的参数来定制弹窗的样式和行为。你可以根据自己的需求选择适当的方法,并设置相应的参数。

猜你喜欢

转载自blog.csdn.net/gao511147456/article/details/131982040