为 @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
});