search
HomeWeChat AppletMini Program DevelopmentWeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

New stuff added today! In addition to the development log itself, I also answered some questions from friends. Without further ado, let’s take a look at the rendering of the “Business Card Box” details page:

WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page


WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

## Note the general requirements: behind the top is a carousel image, the QR code button pops up the modal box information, click on the WeChat bar, click to save to the phone, the address bar needs to display a map, and the business card sharing is also required. Modal box guide.

The first is the carousel image,
autoplay automatic playback, interval carousel time, duration switching speed, you can add it according to your own needs. Delete: It is the delete button. It is hidden after loading. The user needs to click on the carousel image to enter it, and then the carousel image will be displayed in full screen.
noClickImg and ClickImg: Switch between full-screen and non-full-screen carousel images. The click event changeClick is bound to switch. Just change the style.
Block: Picture list.
Number_img: Current carousel index (currentNumber), and image length set (cardnum).
Where currentNumber:

//Change the number when the carousel chart changes

//Initialize data

Data:{

currentNumber:1

}

slidechange:function(e){

var number = e.detail.current;

this.setData({

currentNumber:number+1

})

},

WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

Here you can see the full screen

status When the close button is clicked, getBackStyle switches changeClick to imgFullScrenn on standby.

WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

Click again to return to the original style,


WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

After switching The event goes back to getBackStyle, use it flexibly.


WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

Refresh the developer tools and you can see the specific effect as follows:


WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

You can see on the details page that the information is basically the same style, and you can use the loop block provided by WeChat. The following is the personal information data in the details page. If there is information, it will be displayed. If there is no data, it will not be displayed. Here we use

WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

//Chinese information

           var chinaMessage = res.card.groups[0].fields;

var personMessage= []

           for(var i = 0;i

            personMessage.push(chinaMessage[i])

           }

           //为空或者null是不显示判断

          for(var k in personMessage){

            if(personMessage[k].value==null || personMessage[k].value==""){

            personMessage[k]["display"] = "none";

            }else{

            personMessage[k]["display"] = "block";

            }

           }

Specifically processed in json data format, all we need to do is to bind the display value to it, and then we can call it.


WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

This version of WeChat’s setData does not support asynchronous

updatingdata, so when a real network data request occurs, we must Add forceUpdata() at the end to force the view rendering, otherwise many inexplicable bugs will appear.

WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

#Here is the explanation: This is the real data of the server.


WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page


You can see that an error will be reported. It may be the execution order of js. Go down one by one. At this time Network data is still being requested.


WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

Just define a variable.


WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

Of course the data here is pushed.

WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

The following is the QR code pop-up message.


WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

This is the QR code information of the pop-up modal box. The layout initialization is in the none state. There you need to bind data directly:

This.setData({
//模态框名字:”显示?隐藏”
})

The method is to let it display.


WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

Just call the method from its place. (Supports repeated calls)
The company location map on the details page directly calls the interface provided by WeChat (the demo in the group has an implementation method).
You can see the effect achieved:

WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page


WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page

##[Related recommendations]

1.

Complete source code download of WeChat mini program

2.

WeChat mini program demo: Kaka Auto

3.

Simple left swipe operation and waterfall flow layout

The above is the detailed content of WeChat Mini Program Development (3) Example Tutorial on Business Card Holder Details Page. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.