URLSearchParams & GET Query String & JSON
URLSearchParams & GET Query String & JSON
https://developer.mozilla.org/zh-CN/docs/Web/API/URLSearchParams
http://m.beta.xgqfrms.xyz/ticket/ticket-purchase-notice.html?ts=1579229812&productId=562
window.location.search;
//"?ts=1579229812&productId=562"
const searchParams = new URLSearchParams(window.location.search);
searchParams.get("productId");
// "562"
bug (iOS 上的 webview 自动添加 timestamp 导致,URL 查询字符串,截取 id 错误)
query string 截取错误

/ticket/ticket-purchase-notice.html?ts=1579229812&productId=562


// Bad js
init() {
const spuId = window.location.search.slice(11);
// this.$router.query
// log(`spuId =`, window.location.search, this.$route);
this.fetchTemplate(spuId);
// this.datas = htmlData;
},
OK
/ticket/ticket-purchase-notice.html?productId=562
Webkit Webview
猜测 iOS 在 内嵌webview页面时,url后面加了时间戳是因为这个吧️?

Hash
http://lc.op.beta.xgqfrms.xyz:3010/#/activity-zwy-spu/89815?xxxx=yyy
// const searchParams = new URLSearchParams(window.location.search);
// searchParams.get("productId");
// hash: "#/activity-zwy-spu/71364"
const spuId = this.activityId || window.parent.location.hash.slice(19) || ``;

refs
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
URLSearchParams & GET Query String & JSON的更多相关文章
- nodejs笔记三--url处理、Query String;
URL--该模块包含用以 URL 解析的实用函数. 使用 require('url') 来调用该模块. 一.parse函数的基础用法 parse函数的作用是解析url,返回一个json格式的数组,请看 ...
- query string parameters 、 Form Data 、 Request Payload
微信小程序ajax向后台传递参数的时候总是报400错误 然后看了一下network 发现是query string parameters,但是我写的header如下 header:{ "Co ...
- http 请求参数之Query String Parameters、Form Data、Request Payload
Query String Parameters 当发起一次GET请求时,参数会以url string的形式进行传递.即?后的字符串则为其请求参数,并以&作为分隔符. 如下http请求报文头: ...
- HTTP请求中的form data,request payload,query string parameters以及在node服务器中如何接收这些参数
http://www.cnblogs.com/hsp-blog/p/5919877.html 今天,在工作(倒腾微信小程序)的时候,发现发送post请求到node后台服务器接收不到前端传来的参数.其实 ...
- body传参?parameter传参?Request Payload?Query String Parameter?
今天,是有委屈的一天:今天,是有小情绪的一天.所以,我们要对今天进行小结,跟它做一个了断! 今天,后端来一个接口,告诉我"要用post请求,parameter形式传参".over. ...
- Reading query string values in JavaScript
时间 2016-01-23 13:01:14 CrocoDillon’s Blog 原文 http://crocodillon.com/blog/reading-query-string-valu ...
- elasticsearch 基础 —— Query String
使用查询解析器来解析其内容的查询.下面是一个例子: GET /_search { "query": { "query_string" : { "def ...
- convert URL Query String to Object All In One
convert URL Query String to Object All In One URL / query string / paramas query string to object le ...
- How to get the query string by javascript?
http://techfunda.com/Tools/XmlToJson http://beautifytools.com/xml-to-json-converter.php https://www. ...
随机推荐
- PAT甲级1056Mice and Rice
目录 题目介绍 题解 解题思路 代码 参考链接 题目介绍 题目链接 https://pintia.cn/problem-sets/994805342720868352/problems/9948054 ...
- Prometheus监控Kafka
Prometheus监控Kafka 1.Prometheus监控Kafka,Docker方式 Kafka监控优秀博文: 简书:whaike:[监控]Kafka - 详细指标 CSDN:GeekXuSh ...
- 手机用itunes安装更新系统
1.[Shift+更新]:仅对固件进行更新,保留现有资料和已经安装的程序.但是已经越狱的iPhone或iPad禁止使用此方法!否则有后遗症!没有越狱的iPhone或iPad则可以直接使用此方式.2.[ ...
- 服务器CPU又爆了?Linux快速排查Java程序占用CPU很高的方法
这个问题可以说是 Java 面试的高频面试题了,有很多面试官都喜欢问这个问题,问题可能是下面这样的. 线上一台服务器 CPU 使用率100% 了,如果你碰到这样的情况,如何排查并找到问题原因? 1.场 ...
- linux终端的快捷命令汇总
作者:良知犹存 转载授权以及围观:欢迎添加微信公众号:Conscience_Remains 总述 今天来一篇介绍文哈,关于Linux终端的快捷键的介绍.也是有起因的,最近在移植yocto在服务 ...
- hdu 3974 Assign the task(dfs序上线段树)
Problem Description There is a company that has N employees(numbered from 1 to N),every employee in ...
- poj 2007 凸包构造和极角排序输出(模板题)
Scrambled Polygon Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 10841 Accepted: 508 ...
- int和longlong的范围
unsigned int 0-4294967295 (10位数,4e9) int -2147483648-2147483647 (10位 ...
- Codeforces Round #643 (Div. 2) 题解 (ABCDE)
目录 A. Sequence with Digits B. Young Explorers C. Count Triangles D. Game With Array E. Restorer Dist ...
- python 实现AES加密和解密
参考 https://blog.csdn.net/zhchs2012/article/details/79032656 AES加密算法是一种对称加密算法, 他有一个密匙, 即用来加密, 也用来解密 i ...