通过朋友圈进入小程序“单页”时,如何获取参数 query?

小程序 文章 2020-08-04 16:41 723 0 全屏看文

AI助手支持GPT4.0

通过朋友圈进入小程序“单页”时,如何获取参数 query?

比如我设置分享到朋友圈的 path 是 pages/index/index?testQuery=''test",然后通过朋友圈进入“单页”或者从“单页”进入小程序都解析不到 testQuery 参数。有什么办法能获取到吗?或者我们如何知道哪些用户是通过某一个人分享在朋友圈的链接点击进入的小程序?

For example, if I set the path shared to the circle of friends as pages / index / index? Testquery = "test", and then enter the "single page" through the circle of friends or enter the applet from the "single page", the testquery parameter cannot be resolved. Is there any way to get it? Or how do we know which apps are accessed by someone sharing links in their circle of friends?

回答:

Admin²⁰²⁰:

onLoad里获取

onLoad(options){

console.log("params:",options);

}

正周:

请仔细查看文档

https://developers.weixin.qq.com/miniprogram/deveference/api/Page.html#onShareTimeline


没path参数只有query参数,表示路径“?”后的参数

若认为该回答有用,给回答者点个[ 有用 ],让答案帮助更多的人

o0o有脾气的酸奶:

query: pages/index/index?testQuery=test

若认为该回答有用,给回答者点个[ 有用 ],让答案帮助更多的人

👀:??在哪里能获取到 query 呢?单页中?还是从单页跳转小程序之后,
o0o有脾气的酸奶:pages/index/index.js的onLoad

-EOF-

AI助手支持GPT4.0