這個組件在界面==>交互反饋中 經常使用的哈;
特別注意:如果值title太長了,可能就一個值都不會顯示
1.提示信息;可以用於操作某一項提示用戶是否成功;
uni.showToast({
title: '成功',
icon:'none',//不要圖標
duration: 1000//1后消失
});
提示的內容,長度與 icon 取值有關;所有你要注意一下;
特別注意:如果值太長了,可能就一個值都不會顯示
2.正在加載中
加載中,有加載轉圈;
當你成功后,你就可以關閉這個彈框了;
使用 uni.hideLoading();關閉彈框
uni.showLoading({
title: "加載中"
})
3.模態框,有確認取消按鈕
uni.showModal({
cancelText: "取消", // 取消按鈕的文字
confirmText: "確認", // 確認按鈕文字
title: '刪除提示',
content: '是否刪除該值日學生?',
confirmColor:'#3B8BFF',
cancelColor:'#222222',
success: res => {
if (res.confirm) {
console.log('ok')
} else if (res.cancel) {
// 取消
console.log('cancel')
}
}
});

4.選擇框;幾個值中選擇一個值
uni.showActionSheet({
itemList: ['A', 'B', 'C'],
success: function (res) {
console.log('選中了第' + (res.tapIndex + 1) + '個按鈕');
},
fail: function (res) {
console.log(res.errMsg);
}
});
