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 introduce WeChat Mini Programs LVB subscription reminder component

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

Share

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

This article mainly explains "how to introduce WeChat Mini Programs live subscription reminder function components". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn how to introduce WeChat Mini Programs live subscription reminder components.

WeChat Mini Programs LVB subscription reminder feature is as follows. Users can subscribe to an unstarted live broadcast when they enter the room, and the LVB component will automatically issue a reminder to the user when the broadcast starts.

[subscription] component (Note: to use this component, you need to introduce the live broadcast component before the main package / subpackage)

Function explanation: users can subscribe to an unstarted live broadcast when they enter the room, and the live broadcast component will automatically send a reminder to the user when the broadcast starts, without the need for additional development by the developer.

Component use: if you need to have the same playback reminder feature on Mini Program pages other than the LVB component page, you can introduce the [subscription] component subscribe (it is displayed before broadcasting and disappears automatically after the start of live broadcasting). You need to reference the subscription component in the home.json of page pages (such as home pages). You can use the stopPropagation attribute to control whether to prevent event bubbling (event bubbling is not prevented by default. StopPropagation is false).

The sample code is as follows:

{

"usingComponents": {

"subscribe": "plugin-private://wx2b03c6e691cd7370/components/subscribe/subscribe"

}

}

You can then use the subscription component in home.wxml, where the live room id can be obtained by obtaining the live room list API below. At the same time, the subscription component supports custom color and size, as well as custom parameters, which are described as follows:

Width: indicates width and type is Number

Height: indicates height and type is Number

Font-size: indicates the font size and the type is Number

Color: indicates the font color and type is String

Background-color: indicates the background color and the type is String

Custom-params: indicates a custom parameter of type String

Let width = 120

Let height = 41

Let fontSize = 17

Let color ='# FFFFFF'

Let backgroundColor ='# 6467F0'

Let customParams = encodeURIComponent (JSON.stringify ({path: 'pages/index/index', pid: 1})) / / developers carry custom parameters (such as the path and pid parameters in the example) on the subscription component, which can be obtained later in the options of the App onShow lifecycle (a maximum of 600characters, and the excess will be truncated)

This.setData ({

Width

Height

FontSize

Color

BackgroundColor

CustomParams

})

At this point, I believe you have a deeper understanding of "how to introduce WeChat Mini Programs live subscription reminder components". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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: 0

*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