如何在微信小程序中實現確認框?相信很多沒有經驗的人對此束手無策,為此本文總結了問題出現的原因和解決方法,通過這篇文章希望你能解決這個問題。
核心代碼如下:
delType:function(e){ var typeId = e.currentTarget.dataset['id']; console.log("delete:"+typeId) wx.showModal({ title: '提示', content: '確認要刪除該支出類型?', success: function (res) { if (res.confirm) { console.log('用戶點擊確定') wx.request({ url: getApp().globalData.urlPath + "spendingType/delete", method: "POST", data: { typeId: typeId }, header: { "Content-Type": "application/x-www-form-urlencoded" }, success: function (res) { console.log(res.data.code); if (res.statusCode == 200) { //訪問正常 if (res.data.code == "000000") { wx.showToast({ title: "刪除成功,返回支出類型列表", icon: 'success', duration: 3000, success: function () { wx.navigateTo({ url: '../type/type' }) } }) } } else { wx.showLoading({ title: '系統異常', fail }) setTimeout(function () { wx.hideLoading() }, 2000) } } }) } else if (res.cancel) { console.log('用戶點擊取消') } } }) }
wxml代碼如下:
<text bindtap='delType' data-id="{{item.typeId}}">刪除</text>
看完上述內容,你們掌握如何在微信小程序中實現確認框的方法了嗎?如果還想學到更多技能或想了解更多相關內容,歡迎關注創新互聯行業資訊頻道,感謝各位的閱讀!
新聞標題:如何在微信小程序中實現確認框-創新互聯
鏈接URL:http://vcdvsql.cn/article0/isdoo.html
成都網站建設公司_創新互聯,為您提供自適應網站、網站導航、關鍵詞優化、網站設計、響應式網站、網站內鏈
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯