syncAjax(config)

同步ajax数据请求。

参数说明

  • 入参说明:
参数名 类型 必填 默认值 说明
config Object或string 配置信息,如果为string,默认为url
config.url string 请求地址
config.headers Object 请求头
config.params Object 请求参数
config.method string POST 请求方式
config.timeout number 300000毫秒 请求时间
config.token boolean true 请求时进行token校验
config.baseURL string 基础接口地址
  • 返回数据说明:
    Promise

使用方法

  • 代码示例:

    import { syncAjax } from '@jecloud/utils';
    // 示例:无参数
    const data1 = syncAjax('/je/xxx');
    // 示例: 对象参数
    const data2 = syncAjax({ url: '/je/xxx', params: {}, headers: {} });
  • 事件脚本示例:

    // 函数引用示例如下,操作示例参考上方的代码示例
    const { syncAjax } = JE;
  • 注意
    只支持web端,非特殊情况,不建议使用,同步请求影响页面渲染速度

最后编辑: 秦永莲  文档更新时间: 2024-07-26 14:15   作者:秦永莲