Skip to main content

my.hideToast

hideToast

my.hideToast là API để hide toast thủ công.

Quét mã để trải nghiệm

Xem code mẫu trên Tini Studio

Demo

Trải nghiệm thử với trình giả lập bên dưới

API Params

Thuộc tínhKiểu dữ liệuMô tả
successFunctionCallback function ẩn toast hàm thành công.
failFunctionCallback function khi ẩn toast thất bại.
completeFunctionCallback function khi hoàn tất gọi hàm bất kể thành công hay thất bại.

Sample Code

index.txml
<view class="page">
<view class="page-description">Loading API</view>
<view class="page-section">
<view class="page-section-title">my.hideLoading</view>
<view class="page-section-demo">
<button type="primary" onTap="onHideToast">Show toast and hide after 3s</button>
</view>
</view>
</view>
index.js
Page({
onHideToast() {
my.showToast({
type: 'fail',
content: 'Toast content',
buttonText: 'OK',
success: () => {
my.alert({ title: 'success' });
},
fail: (e) => {
my.alert({ title: `${e}` });
},
complete: () => {
console.log('Complete');
}
});
setTimeout(() => {
my.hideToast();
}, 3000);
}
});