fix(axios): get等方法配置ignoreCancelToken无效

pull/35/head
xingyu 2023-09-18 18:12:37 +08:00
parent 6034ffecf2
commit f712bbf370
2 changed files with 5 additions and 2 deletions

View File

@ -22,5 +22,5 @@ export const buttonProps = {
* @default: 14
*/
iconSize: { type: Number, default: 14 },
onClick: { type: Function as PropType<(...args) => any>, default: null },
onClick: { type: [Function, Array] as PropType<(() => any) | (() => any)[]>, default: null },
}

View File

@ -90,7 +90,7 @@ export class VAxios {
// 请求拦截器配置处理
this.axiosInstance.interceptors.request.use((config: InternalAxiosRequestConfig) => {
const { requestOptions } = this.options
const requestOptions = (config as unknown as any).requestOptions ?? this.options.requestOptions
const ignoreCancelToken = requestOptions?.ignoreCancelToken ?? true
!ignoreCancelToken && axiosCanceler.addPending(config)
@ -331,6 +331,9 @@ export class VAxios {
if (config.cancelToken)
conf.cancelToken = config.cancelToken
if (config.signal)
conf.signal = config.signal
const transform = this.getTransform()
const { requestOptions } = this.options