vue解决$notify消息通知循环折叠

543 阅读1分钟

这是我参与8月更文挑战的第3天,活动详情查看:8月更文挑战

1、具体实现类,that.xxx是循环的数据

for (var i = 0; i < that.xxx.length; i++) {
          (function(a) {
            setTimeout(function() {
              that.$notify({
                title: "新消息",
                type: "warning",
                message: that.xxx[a].reportUnit,
                position: "bottom-right",
                duration: 0,
                onClose: function() {},
                onClick: function() {
                  this.close();
                  this.$alert(that.xxx[a].reportUnit, "通知", {
                    dangerouslyUseHTMLString: true
                  });
                }
              });
            }, 1000);
          })(i);
        }