CN-747: http请求支持取消

This commit is contained in:
刘洪洪
2022-10-19 15:27:26 +08:00
parent 111f731712
commit 15cfd48770
6 changed files with 60 additions and 8 deletions

View File

@@ -55,6 +55,7 @@ import { getTypeCategory } from '@/views/charts/charts/tools'
import { computeScore, urlParamsHandler, overwriteUrl } from '@/utils/tools'
import ChartList from '@/views/charts2/ChartList'
import { get } from '@/utils/http'
import { useStore } from 'vuex'
export default {
name: 'Panel',
@@ -156,6 +157,19 @@ export default {
})
},
setup (props, ctx) {
// todo 目前在panel页面测试后续会挪到router里
const store = useStore()
const cancelList = store.state.panel.httpCancel
// 进入页面时,发现有未结束的请求,终止请求
// console.log('panel.vue------setup------查看http终止情况', cancelList, cancelList.length)
if (cancelList.length > 0) {
cancelList.forEach((cancel, index) => {
cancel()
delete cancelList[index]
})
}
const panel = ref({})
let panelType = 1 // 取得panel的type
const { params, query } = useRoute()