<template>
  <div @click="clear">
    定时器暂停
  </div>
</template>

<script setup>
import { useStore } from "vuex";
import { liveMsgSend } from "@/api/video";

const store = useStore();

let msgIndex = 0;
let time;
if(store.state.userInfo.account === window.config.testReactionUserId && window.config.testReactionId) {
  console.log(time)
  time = setInterval(() => {
    msgIndex++;
    if(msgIndex === 10000) clearInterval(time)
    liveMsgSend({
      from: window.config.testReactionUserId,
      groupId: window.config.testReactionId,
      text: "消息" + msgIndex,
      type: 1,
    }).catch(() => {
      // errorBack && errorBack();
    });
  }, 20);
}

const clear = () =>{
  clearInterval(time)
}

</script>
<style scoped lang='scss'>
</style>