【发布时间】:2019-04-24 09:10:24
【问题描述】:
我有一个反应组件,它包含一些内容,如果用户调整屏幕大小,它在 1024 像素以下的屏幕中不可用,一个事件将被触发,打开一个只能关闭点击它的 toast,但如果用户调整分辨率大小再次我想自动关闭这个吐司。 有没有办法强制特定的 toast 关闭分配某种 id 以找到它并使用 javascript 单击它?
// this calls a generic function that opens a toast.
manageWarning('', 'You are running on a small screen resolution, this feature it\'s only available on screens up to 1024 px, please scale up the window again', true);
// This is the generic function
export function manageWarning(id, message, disableAutoClose) {
toastr.options.timeOut = disableAutoClose ? 0 : Global.MESSAGE_ERROR_DURATION;
toastr.options.extendedTimeOut = disableAutoClose ? 0 : toastr.options.extendedTimeOut;
toastr.warning(message);
}
【问题讨论】:
标签: javascript toastr