Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get the link parameters of sharing cards in WeChat Mini Programs LVB

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to get the link parameters of the sharing card in WeChat Mini Programs Live". In the daily operation, I believe many people have doubts about how to obtain the link parameters of the sharing card in WeChat Mini Programs Live. The editor consulted all kinds of materials and sorted out the simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to get the link parameters of sharing cards by WeChat Mini Programs Live". Next, please follow the editor to study!

API description: due to the data security policy of the basic library, the query in the lifecycle of App onShow (you need to introduce the LVB component in the main package) or Page onShow (you need to introduce the LVB component in the subpackage) cannot obtain the LVB room sharing card link parameters. The following parameters are obtained through this API in LVB component version 1.1.4 and above. Developers can establish mapping relationships among users, live rooms and products based on these parameters.

Share the card into the live room: room number room_id + entrant openid + sharer share_openid + developer custom parameter custom_params

Calling method: to call the [get shared Card Link parameters] API getShareParams, you need to reference [LVB component] live-player-plugin at the top of the Mini Program page.

The sample code is as follows:

Let livePlayer = requirePlugin ('live-player-plugin')

App ({

OnShow (options) {

/ / only call getShareParams API for sharing card entry scenario to obtain the following parameters

If (options.scene = = 1007 | | options.scene = = 1008 | | options.scene = = 1044 | | pluginScene = = 1154 | | pluginScene = 1155) {

LivePlayer.getShareParams ()

.then (res = > {

/ / Room number

Console.log ('get room id', res.room_id)

/ / user openid

Console.log ('get openid', res.openid)

/ / openid of the sharer, only when the sharing card enters the scene

Console.log ('get share openid', res.share_openid)

/ / the custom parameters carried on the page path when the developer jumps to the live room page, which is returned to the developer.

Console.log ('get custom params', res.custom_params)

}) .catch (err = > {

Console.log ('get share params', err)

})

}

}

})

At this point, the study on "WeChat Mini Programs Live how to get the link parameters of the sharing card" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 229

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report