小程序封裝提示彈窗showToast

 最好放到app.js中,作爲公共函數

  //title(標題),
  //icon(圖標),  success,loading,none
  //duration(延時) 0爲不關閉, 毫秒數
  //options(其它參數),

  toast(title, icon = 'none', duration, options) {
    wx.showToast({
      title: title || '',
      icon: icon,
      image: (options && options.image) || '',
      duration: duration || 1500,
      mask: (options && options.mask) || true,
    });
  }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章