vue-request icon indicating copy to clipboard operation
vue-request copied to clipboard

[Bug Report] undefined injectedGlobalOptions

Open FirstSanny opened this issue 2 years ago • 3 comments

Bug 描述 Bug description

In the usePagination function we are running into the problem that injectedGlobalOptions are undefined in this line pagination: (_injectedGlobalOption = injectedGlobalOptions.pagination) !== null && _injectedGlobalOption !== void 0 ? _injectedGlobalOption : {} When just replacing injectedGlobalOptions.pagination with injectedGlobalOptions?.pagination it works.

代码重现 Reproduce

I honestly dont know how to reproduce it.

期望结果 Desired result

No undefined error and breaking the code.

其他信息 Other information

FirstSanny avatar Jan 26 '23 10:01 FirstSanny

Same for me

image

image

This line is undefined

const injectedGlobalOptions = vueDemi.inject(GLOBAL_OPTIONS_PROVIDE_KEY, {}); I'm using the same service on every page with the same data, but just in one page is broken with this error.

LuXDAmore avatar Jan 08 '24 09:01 LuXDAmore

我出现类似问题,最终发现是各个组件库依赖的vue-demi的版本不一致导致的问题

liuhean avatar Jan 30 '24 09:01 liuhean

我也遇到了类似的问题,出现的情况是没有在正确的inject环境使用,vue-request 应该排除 没有inject的情况时,也能正确使用,比如在一个js文件中使用时

code-lixm avatar Jul 26 '24 04:07 code-lixm