我需要在我的应用程序屏幕上创建一个 toast,今天如果我多次单击一个按钮,则会显示几个 toast。
编辑:
showToast: function(message) {
var openedToast = Ext.get(document.querySelector('[id^="toast-"]'));
if (openedToast != null) {
var toast = Ext.getCmp(openedToast.id);
toast.close();
}
Ext.defer(function() {
Ext.toast({
html: message,
align: 't'
});
}, 80);
}
但是如果用户快速点击按钮,toast 会创建几次