Mini program development DEMO example
WeChat applet layout example:
The following will be introduced in the following order:
Implementation of layout
Implementation of logic
Implementation of style
1. Layout implementation
The largest layout is view. The view layout includes: a picture, text description, information bar and dividing line
<!--最外层--> <view class="home-view1"> <!--图片层--> <view class="home-view2"> <image class="home-image1" src="http://qty83k.creatby.com/materials/origin/640e31829b8776967dedc670b5427d0f_origin.jpg"></image> </view> <!--描述层--> <text class="home-text1">小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物</text> <!--信息层--> <view class="home-view3"> <view class="home-view4" > <image class="home-image-heart" src="http://qty83k.creatby.com/materials/origin/c5656ef00d38d89eae437c5a9102f8fa_origin.png"></image> <text class="home-text-heart bgColor" > 22</text> </view> <text class="home-text-time" >2016.10.29</text> </view> <!--分界线line--> <view class="home-view-line"></view> <!--图片层(下面的代码直接复制了上面的所有布局代码)--> <view class="home-view2"> <image class="home-image1" src="http://qty83k.creatby.com/materials/origin/640e31829b8776967dedc670b5427d0f_origin.jpg"></image> </view> <!--描述层--> <text class="home-text1">小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物小巧可爱的案头雅物</text> <!--信息层--> <view class="home-view3"> <view class="home-view4" > <image class="home-image-heart" src="http://qty83k.creatby.com/materials/origin/c5656ef00d38d89eae437c5a9102f8fa_origin.png"></image> <text class="home-text-heart bgColor" > 22</text> </view> <text class="home-text-time" >2016.10.29</text> </view> <!--分界线line--> <view class="home-view-line"></view> </view>
2 .Logic implementation
Just registers the Page interface
Page({ data:{ } })
3.Style implementation
.home-view1 style:displaySpecifies the maximum View layout It is a flexible layout, justify-content specifies that the content is centered and arranged vertically, ...
.home-view3 style: display specifies that the information bar layout is a flexible layout, justify-content specifies Content is evenly distributed horizontally
.home-view4 style: display specifies that the parent layout of collection pictures and collection numbers is a flexible layout, and align-items specifies that the content is centered vertically
.home- image1 style: specifies the height of the image
.home-image-heart style: specifies the size of the collected image
.home-text1 style: specifies the style of the description text, text-align Specifies the text to be centered, line-heightSpecifies the height between two lines of text
.home-text-heart style: specifies the style of the collection number, border-radius specifies the border rounded corners
.home-view-line style: is a dividing line
.bgColor style: specifies the background of the collection number
.home-view1{ display: flex; justify-content: center; flex-direction: column; height: 100%; width: 100%; margin: 6px; } .home-view3{ display: flex; justify-content: space-between; } .home-view4{ display: flex; align-items: center; } .home-image1{ height: 200px; } .home-image-heart{ width: 30px; height: 30px; } .home-text1{ text-align: left; line-height: 25px; margin-top: 6px; margin-right: 6px; color: gray; } .home-text-heart{ width: 22px; height: 22px; margin-left: 10px; border-radius: 20%; pad: 5px; text-align: center; } .home-text-time{ text-align: center; margin-right: 20px; padding-top: 5px; color: gray; } .home-view-line{ width: 100%; height: 6px; margin-top: 5px; background-color: gainsboro; } .bgColor{ background-color: lightblue; opacity: 0.6; }
[Related Recommendation】
1. Complete source code download of WeChat mini program
2. WeChat mini program learning demo: chat room + audio and video + adding content
The above is the detailed content of Mini program development DEMO example. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The word demo is no longer unfamiliar to friends who like to sing, but many users who have never been exposed to it are curious about what demo means. Now let’s take a look at the meaning of the demo brought by the editor. What does demo mean? Answer: Demo tape. 1. The pronunciation of demo is ['deməʊ] in English and ['demoʊ] in America. 2. Demo is the abbreviation of "demonstration", which generally refers to the preliminary effect of listening to a song before it is officially recorded. 3. Demo is used as a noun to refer to sample tapes and sample records. The meaning of verb is trial (especially software), demonstration and demonstration;

Simple use of pythonrandom library demo When we need to generate random numbers or randomly select elements from a sequence, we can use Python's built-in random library. The following is an annotated example that demonstrates how to use the random library: #Import random library importrandom #Generate a random decimal between 0 and 1 random_float=random.random()print(random_float)#Generate a random decimal within the specified range Random integer (including endpoints) random_int=random.randint(1,10)print(random_int)#

PHP's page jump and routing management in mini program development With the rapid development of mini programs, more and more developers are beginning to combine PHP with mini program development. In the development of small programs, page jump and routing management are very important parts, which can help developers achieve switching and navigation operations between pages. As a commonly used server-side programming language, PHP can interact well with mini programs and transfer data. Let’s take a detailed look at PHP’s page jump and routing management in mini programs. 1. Page jump base

How to develop and publish mini programs in uni-app With the development of mobile Internet, mini programs have become an important direction in mobile application development. As a cross-platform development framework, uni-app can support the development of multiple small program platforms at the same time, such as WeChat, Alipay, Baidu, etc. The following will introduce in detail how to use uni-app to develop and publish small programs, and provide some specific code examples. 1. Preparation before developing small programs. Before starting to use uni-app to develop small programs, you need to do some preparations.

PHP permission management and user role setting in mini program development. With the popularity of mini programs and the expansion of their application scope, users have put forward higher requirements for the functions and security of mini programs. Among them, permission management and user role setting are An important part of ensuring the security of mini programs. Using PHP for permission management and user role setting in mini programs can effectively protect user data and privacy. The following will introduce how to implement this function. 1. Implementation of Permission Management Permission management refers to granting different operating permissions based on the user's identity and role. in small

PHP data caching and caching strategies in mini program development With the rapid development of mini programs, more developers are beginning to pay attention to how to improve the performance and response speed of mini programs. One of the important optimization methods is to use data caching to reduce frequent access to the database and external interfaces. In PHP, we can use various caching strategies to implement data caching. This article will introduce the principles of data caching in PHP and provide sample codes for several common caching strategies. 1. Data caching principle Data caching refers to storing data in memory to

PHP security protection and attack prevention in mini program development With the rapid development of the mobile Internet, mini programs have become an important part of people's lives. As a powerful and flexible back-end development language, PHP is also widely used in the development of small programs. However, security issues have always been an aspect that needs attention in program development. This article will focus on PHP security protection and attack prevention in small program development, and provide some code examples. XSS (Cross-site Scripting Attack) Prevention XSS attack refers to hackers injecting malicious scripts into web pages

Today we will learn how to implement the drop-down menu developed in PHP in the WeChat applet. WeChat mini program is a lightweight application that users can use directly in WeChat without downloading and installing, which is very convenient. PHP is a very popular back-end programming language and a language that works well with WeChat mini programs. Let's take a look at how to use PHP to develop drop-down menus in WeChat mini programs. First, we need to prepare the development environment, including PHP, WeChat applet development tools and servers. then we
