uniapp常用提示框uni.showToast(OBJECT)


新做uni項目,記錄一下常用的方法
官方參考文檔:https://uniapp.dcloud.io/api/ui/prompt?id=showtoast
1:成功提示
提交表單的時候,如果提交成功

uni.showToast({
title: '提交成功',
duration: 2000
});


2:加載框

uni.showLoading({
    title: '加載中'
});
                    
    setTimeout(function () {
        uni.hideLoading();
    }, 2000);


3:去掉圖標,只顯示文字

uni.showToast({
title: '請填寫員工工號',
icon:'none',
duration: 2000
});


4:模態彈窗

              uni.showModal({
                        title: '提示',
                        content: '這是一個模態彈窗',
                        success: function (res) {
                            if (res.confirm) {
                                console.log('用戶點擊確定');
                            } else if (res.cancel) {
                                console.log('用戶點擊取消');
                            }
                        }
                    });


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM