Bootstrap

前端多tab切换,请求并发,导致数据错乱

const requestKey = ref(0);
 const currentKey = requestKey.value;
 接口请求
 // 检查请求标识是否一致
 if (requestKey.value !== currentKey) {
        console.log('Request key mismatch, ignoring this response.');
        return;
    }


在切换tab的时候
requestKey.value += 1;


接口请求里面
 if (requestKey.value !== key) {
      console.log('Request key mismatch, ignoring this response.');
      return [];
  }
;