默认分类

JS实现JSON对象转URL参数

    /**
     *
     * @param {*} json 需要转换的对象
     * @param {Array} ignoreFields 过滤字段
     */
    const jsonToUrlParam = (json, ignoreFields) => {
      return Object.keys(json)
        .filter(key => ignoreFields.indexOf(key) === -1)
        .map(key => key + '=' + (json[key] ?? ''))
        .join('&')
    }
This is just a placeholder img.