Function obj2UrlParam

  • 将对象转换为URL查询字符串

    Parameters

    • obj: Recordable

      需要转换的对象(例如:{ name: 'John', age: 20 })

    • excludeKey: string[] = []

      需要排除的键名数组(默认空数组)

    • decodeFlag: boolean = false

      是否对结果进行URI解码(默认false)

    Returns string

    拼接后的URL查询字符串(例如:name=John&age=20)

    const params = { name: 'John', age: 20 };
    const str = obj2UrlParam(params, ['age']); // "name=John"