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. ...
随机推荐
- docker(mysql-redmine)
一.安装docker 首先查看自己的版本,我的是centos 版本为 [root@localhost redmine]# uname -r 3.10.0-862.el7.x86_64 移除旧版本 yu ...
- 截止9月20日,xx行动中已知漏洞
VMware Fusion cve-2020-3980权限提升 Apache Cocoon security vulnerability cve-2020-11991 Spring框架RFD(文件下载 ...
- python模块----sys模块 (系统相关的参数和函数)
pprint 模块:它给我们提供了一个方法 pprint() 该方法可以用来对打印的数据做简单的格式化 sys模块+pprint模块 标准库网址(sys):https://docs.python.or ...
- C++类基本--随笔一
#include <iostream> using namespace std; class Teacher { public: Teacher(int m=3,int n=2) { a= ...
- thymeleaf第二篇:理解原理并为后面springboot进行整合进行铺垫
官方入门之从虚拟商店理解thymeleaf 参考文档: 简单使用Thymeleaf API渲染模板生成静态页面 邮件通知改造之Thymeleaf渲染模板生成静态页面--看懂会帮助理解springboo ...
- 90% 的 Java 程序员都说不上来的为何 Java 代码越执行越快(2)- TLAB预热
经常听到 Java 性能不如 C/C++ 的言论,也经常听说 Java 程序需要预热,那么其中主要原因是啥呢? 面试的时候谈到 JVM,也有很多面试官喜欢问,为啥 Java 程序越执行越快呢? 一般人 ...
- PHP基础之与MySQL那些事
前言 这篇文章会对PHP的MySQL扩展库,MySQLI的扩展库,SQL批量执行,事务控制等等进行一些简单的讲解. MySQL扩展 PHP中MySQL扩展,虽然因为安全的原因,在PHP5.6及往上不在 ...
- Hiho1422 Harmonic Matrix Counter (高斯消元)
16年北京站A题 真的难啊.. 题意: 定义和谐矩阵 就是每个元素和上下左右的xor值=0 输出一个超大数 然后最多800个询问 求字典序第k小的和谐矩阵 x y位置上的数 题解: 首先这个超大数的范 ...
- Codeforces Round #656 (Div. 3) A. Three Pairwise Maximums
题目链接:https://codeforces.com/contest/1385/problem/A 题意 给出三个正整数 $x,y,z$,找出三个正整数 $a,b,c$ 使得 $x = max(a, ...
- Codeforces Global Round 7 C. Permutation Partitions(组合数学)
题意: 给你 n 长全排列的一种情况,将其分为 k 份,取每份中的最大值相加,输出和的最大值和有多少种分法等于最大值. 思路: 取前 k 大值,储存下标,每两个 k 大值间有 vi+1 - vi 种分 ...