系统要实现一个简单的异常日志提示框,决定使用定时器,每隔2秒向后端发送请求
效果图:
登录后,开启定时器
data() {
return {
isExistNo: false,
timer:null, //定时器名称
};
},
created() {
const _this = this;
this.timer = window.setInterval(() => {
_this.$api.post(_this.$lesUiPath.msgAlert).then(result => {
if (result !== "") {
if (_this.isExistNo)