Appearance
基础配置初始化 - initConfig
简介
- 此API是一个单向任务
环境适配说明
| 环境名称 | 是否支持 | jssdk文件最低版本号 | npm包最低版本号 |
|---|---|---|---|
| 湘易办APP-小程序 | ✅ | -- | 0.1.0 |
| 湘易办APP-小程序-webview | ✅ | -- | 0.1.0 |
| 湘易办APP-webview | ✅ | -- | 0.1.0 |
| 三方H5 | ✅ | -- | 0.1.0 |
| 三方小程序-H5 | ✅ | -- | 0.1.0 |
参数
| 参数名 | 类型 | 可选值 | 描述 |
|---|---|---|---|
| appId | Array | -- | 能力的APPID清单 |
| needOb | Boolean | true / false | 接口请求是否需要被监控 |
| baseURL | String | -- | 接口请求的基础URL地址 |
| appCode | String | -- | 应用编码 |
| headers | Object | -- | 接口请求头配置 |
| autoUpdate | Boolean | true / false | 是否需要自动更新胶囊按钮配置 |
| needConfig | Boolean | true / false | 接口请求是否需要返回配置信息 |
| wxSignParam | Object | -- | 微信小程序下H5页面的加签信息 |
| autoConfig | Boolean | true / false | 是否需要自动配置胶囊按钮配置 |
| reqInterceptor | Function | -- | 接口请求拦截器 |
| resInterceptor | Function | -- | 接口相应拦截器 |
返回值 - 无
示例
javascript
$xybAgent.initConfig({
appId: ['123123321'],
needOb: true,
baseURL: "https://www.google.com",
appCode: "123123213",
headers: {
contentType: "application/json"
},
autoUpdate: true,
needConfig: true,
wxSignParam: {
sign: 'xxxx'
},
autoConfig: true,
reqInterceptor: (req) => {
// do sth
},
resInterceptor: (res) => {
// do sth
}
});