相关疑难解决方法(0)

URLSearchParams 为第一个查询字符串返回 null

为什么时间段为空

const url = 'http://example.com?timeperiod=lasttwentyeightdays&pagesize=20'
const args =  new URLSearchParams(url);
alert('timeperiod='+args.get('timeperiod') + ' and pagesize='+ args.get('pagesize'));
Run Code Online (Sandbox Code Playgroud)

但在下面的代码中它有效

  const url = 'http://example.com?x=c&timeperiod=lasttwentyeightdays&pagesize=20'
  const args =  new URLSearchParams(url);
  alert('timeperiod='+args.get('timeperiod') + ' and pagesize='+ args.get('pagesize'));
Run Code Online (Sandbox Code Playgroud)

html javascript

9
推荐指数
1
解决办法
4504
查看次数

标签 统计

html ×1

javascript ×1