通过URL Scheme方式进入小程序后,如何拿到后台传过来的参数?

小程序 文章 2021-01-26 10:41 0 238 全屏看文

通过URL Scheme方式进入小程序后,如何拿到后台传过来的参数?After entering the Mini Program through URL Scheme, how do I get the parameters passed from the background?

通过URL Scheme方式进入小程序后,如何拿到后台传过来的参数?

通过 URL Scheme 方式进入小程序,生成 Scheme 时传入的 jump_wxa 为 { path: "pages/test/test", query: "query=test"} (我查阅了社区其他人大致时这么传 query 的,即 key=value的形式),目前可以进入指定的 path 页面,但是在 test 页面 onLoad 的 options 里面直接用 options.query 获取不到 test,请问有踩过坑的大神教下如何在 options 中拿到传进来的参数吗,拿到的值是字符串还是对象,这个要发布的小程序才可以测试,开发者工具也没有提供模拟这种场景的1065,真蛋疼。

Enter the applet through URL scheme and generate the jump passed in when scheme is generated_ Wxa is {path: "pages / test / test,", Query: "query = test"} (I looked up the form of key = value that other people in the community spread about query in Zhishi). At present, you can enter the specified path page, but you can directly use it in the options of onload on the test page options.query You can't get the test. How can you get the test in options Do you get the parameters passed in? Is the value obtained a string or an object? This small program to be released can be tested. The developer tool does not provide 1065 to simulate this scenario. It's really painful.

回答:

brave:

打印一下options应该不难吧??

|G.XIAO|:

楼上正解

-EOF-