1==》wx.showToast 彈出層 在界面交互中 顯示消息提示框 它是一個消失提示框 提示用戶成功 或者失敗等消息 <button size='mini' bindtap='hanleShowToasr'>彈出層</button> hanleShowToasr(){ wx.showToast({ title: '成功了', duration:2000, //2s后消失 icon: 'none',//去除小圖標 }) },
2==》顯示模態對話框 wx.showModal 它不僅有消失提示 還有確定和取消按鈕 <button size='mini' bindtap='getshowModal'>彈出層</button> getshowModal(){ wx.showModal({ title: '提示', content: '這是一個模態彈窗', showCancel:false,//是否顯示取消按鈕 false 不顯示 cancelText:"取消哦",//更改取消 confirmText:"吃工了", success(res) { if (res.confirm) { console.log('用戶點擊確定') } else if (res.cancel) { console.log('用戶點擊取消') } } }) },