【需求1】利用节流方式只展示第一条错误;多个接口请求返回的msg

73 阅读1分钟
    if (state.message) {
        if (timer) {
            return;
        }
        timer = setTimeout(function () {
            const newMessage = state.message.replaceAll('|', '<br />');
            Notification({
                title: '暂无权限',
                dangerouslyUseHTMLString: true,
                message: '您没有当前操作的访问权限,请联系管理员授权。[<br />' + newMessage + ']',
                customClass: 'auth-notification',
                duration: 10000,
                type: 'error',
            });
            actions.setGlobalState({ message: null });
            clearTimeout(timer);
            timer = null;
        }, 300);
    }