使用情景

前端通过路径拼接进行传值

处理路径

// 引入node的核心模块
const qs = require("querystring");

  const pathParams = (url)=>{
    // 将请求路径以?切割为数组,并获取?后面的元素
    let str = url.split("?")[1];
    //将字符串转为对象
    return qs.parse(str);

}

export default pathParams;

 

相关文章:

  • 2022-12-23
  • 2021-10-10
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
相关资源
相似解决方案