@corgicoding/axios-hook
v2.1.1
Published
组件库为了获取 vue 模板实例设计的 hook
Downloads
13
Maintainers
Readme
@corgicoding/axios-hook
为 @corgicoding/web-quick-start
工程模板设定的组件库 axios
实例获取
逻辑
通过判断是否有以下两种参数,否则返回默认 axios
axios-instance
参数inject
- 获取当前页面是否挂载了全局
$http
使用
- 在外部工程需满足以下
app.provide('axios-instance', axios);
- 如果使用
el-libs
则在引入时配置
import httpInstance from '@/services/http/index';
import WELLComponent from '@corgicoding/el-libs';
import '@corgicoding/el-libs/lib/style.css';
app.use(WELLComponent, {
global: false,
axios: httpInstance,
prefixCode: import.meta.env.VITE_PLATFORM_CODE || '',
rules: validateActionPermission
});