In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of WeChat Mini Programs's common interview questions, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this WeChat Mini Programs's common interview questions. let's take a look.
1. How to get user information in Mini Program?
(1) before Mini Program upgrade: you can use wx.getUserInfo to obtain user information directly, but now you can no longer use this method.
(2.) after upgrading, you can use the following methods to obtain the user's account information:
(1) use button and set its property: open-type= "getUserInfo" to get user information.
two。 How to realize the sharing function in Mini Program, and what are the restrictions on Wechat?
Send to friends: onShareAppMessage (Object object)
Share to moments: onShareTimeline ()
Restrictions:
In single page mode, there are certain restrictions on some components or interfaces:
1. There is no login status on the page, and the login-related APIs and wx.login () are not available.
2. It is not allowed to jump to other pages, including Mini Program pages, Mini Program pages, and Wechat native pages.
3. Horizontal screen is not allowed, and the tabbar contained in the page will not be rendered, including custom tabbar
4. Local storage is not shared with Mini Program normal mode.
3. How did your Mini Program come online and how long will it take to review it?
(1) find the project in Wechat web developer tool, and set the domain name of the server. If your Mini Program does not use public network requests, you do not need to configure the server. After configuring the server, preview it first to see if there is any problem, and if there is no problem, click upload.
(2) after uploading the code, log in to WeChat Mini Programs backend on the Wechat official account platform, click Development Management, and you can see the code you just uploaded. Click submit for review. The next step is to wait for official approval from Wechat.
(3) it usually lasts about 1-3 days.
4. How do I use third-party components like Vant in Mini Program?
(1) Open cmd, enter your project, and execute in cmd: npm init, initialize the project
(2) then install Vant
(3) Open Mini Program client and select * * tools * * menu-> * * build npm * * command.
5. How does Mini Program realize the parameter transfer between parent and child components?
1. The parent component passes values to the child component
Define properties in subcomponents
Properties: {/ / complex definition name: {type: String, value:' Zhang Sanfeng'}, / / simple definition name2:String}
The parent component passes the value to the child component by setting the property when referencing the child component.
2. The child component passes the value to the parent component
Bind a custom event in the component
/ / refers to the custom component and binds the myevent event, which corresponds to the parentEvent method
This event is triggered in the child component, and the value can be passed to the parent component.
Events are triggered by triggerEvent in sub-components
Methods: {method name: function () {var myEventDetail = {} / / detail object, provided to the event listener function var myEventOption = {} / / the option this.triggerEvent ('myevent', myEventDetail, myEventOption)} 6. What is the life cycle of APP in Mini Program?
OnLaunch (options)
Called when Mini Program is loaded. This method is generally used to do some initialization. For example, access to user information, access to historical cache information, access to Mini Program open sources and so on.
OnShow (options)
Called when Mini Program starts or enters the foreground display from the background. If you want to do something every time Mini Program enters the foreground, you can put the code in this. For example, some real-time dynamic changes of data, users every time they come in to update from the server, then we can do it in this.
OnHide ()
Mini Program is switched to the background (including when Wechat itself is switched to the background or Mini Program is temporarily switched to the background). You can save some data in this method.
OnError (String error)
Triggered when a script error occurs on Mini Program or when the api call fails. When an error occurs on Mini Program, the error message will be sent to this function, so you can do some error collection in this function.
OnPageNotFound (Object)
Triggered when the page that Mini Program wants to open does not exist. Usually when the code is updated, some pages are deleted, but this happens when there is no change elsewhere, or some active pages are closed after the event. You can also do some wrong collection and page redirection in this.
GetApp ()
Gets the current app object. It is usually called outside the app.js. Within app.js, you can use this to get the current large object; outside, when you want to use global data defined in app.js, use getApp ().
7. What is the life cycle of Page in Mini Program?
OnLoad (), onReady (), onShow (), onHide (), onUnload () five page lifecycle functions, which are called when the page is loaded, ready, rendered, hidden, and unloaded, respectively.
8. How does Mini Program define events?
In Mini Program, you can bind an event that starts with bind and then follows the type of the event. For example, bindtap binds a click event and the corresponding value is a string. You need to define a function with the same name in the page constructor. Each time the event is triggered, the contents of the corresponding function will be executed.
9. How to stop the Mini Program event from bubbling?
In Mini Program, in addition to bind, you can also bind events through catch. Events bound through catch do not trigger event bubbles.
10. How do I get the event triggered during the capture phase?
The trigger of the event is divided into two stages, the first is the capture stage, and the second is the bubbling stage. By default, events are triggered during the bubbling phase. If you want the event to be triggered during the capture phase, you can bind the event through capture-bind.
This is the end of the article on "what are the common interview questions of WeChat Mini Programs?" Thank you for your reading. I believe you all have a certain understanding of the knowledge of "what are the common interview questions of WeChat Mini Programs". If you still want to learn more knowledge, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.