| | |
| | | </template> |
| | | |
| | | <script> |
| | | let teimss = null; |
| | | let teimss = null; // 轮询获取账户金额计时器 |
| | | let teimss2 = null; // 轮询获取持仓数据计时器 |
| | | import tabHead from "@/components/tabHead.vue"; |
| | | import * as api from "@/axios/api"; |
| | | export default { |
| | |
| | | handler(state) { |
| | | this.pageNum = 1; |
| | | this.getList(state); |
| | | |
| | | clearInterval(teimss2); |
| | | // 判断如果是获取平仓数据就不再轮询 |
| | | if(state == '1') return |
| | | teimss2 = setInterval(() => { |
| | | this.getList(state); |
| | | }, 3000); |
| | | }, |
| | | immediate: true |
| | | } |
| | |
| | | }, |
| | | beforeDestroy() { |
| | | clearInterval(teimss); |
| | | clearInterval(teimss2); |
| | | }, |
| | | methods: { |
| | | // 获取 持仓 数据 |
| | |
| | | pageNum: this.pageNum, |
| | | pageSize: this.pageSize |
| | | }; |
| | | |
| | | let data = await api.getchicang(opt); |
| | | |
| | | if (data.status === 0) { |
| | | if (this.active == "0") this.list = data.data.list; |
| | | else this.list2 = data.data.list; |