This article brings you relevant knowledge about WeChat Mini Program, which mainly introduces the relevant content about WXML template syntax, including data binding, event binding, conditional rendering, List rendering and other issues, let’s take a look at them below, I hope it will be helpful to everyone.
【Related learning recommendations: 小program learning tutorial】
WXML Template syntax- Data binding
1. Basic principles of data binding
① Define data in data #②
Using data inWXML
2.In# Define the data of the page in ##data In the
.js file corresponding to the page, define the data Just go to the data object:
Grammar format##
Bind the data indata To render in the page, use Mustache syntax (double braces) to wrap the variables . Similar to the interpolation expression in vue, the syntax format is:
4. Mustache
Application scenarios of grammar Binding content
Binding attributes- Operations (ternary operations, arithmetic operations etc.)
- 5.
Dynamic binding content
# page of the data as follows:
The structure of the page is as follows:
The data on the
page is as follows:
Q
7.Ternary operation
The data on the page is as follows:
The structure of the page is as follows:
#8.
Arithmetic operations
##
WXML Template Syntax
- Event binding:1. What is an event
Events are the communication method from the rendering layer to the logic layer. Through events, the user's behavior in the rendering layer can be fed back to the logic layer for business processing.
2.
Commonly used events in mini programs
##Type
Tied Defined method |
Event description |
tap |
||
or bind: tap | The finger touches and leaves immediately, similar to click ## in HTML | #event|||
input |
##bindinput or bind:input |
Input event of text box |
||
change |
bindchange or bind:change |
Triggered when status changes |
##Attributes
| ##Type
| Description|||
String |
Event Type |
|||
Integer |
page opens The number of milliseconds that elapsed until the event was triggered |
|||
Object |
A collection of some property values of the component that triggers the event |
| currentTarget||
Object |
##A collection of some attribute values of the current component |
##detail |
||
##Object
|
Additional information
|
touches |
Array |
Touch event, array of touch point information currently staying on the screen |
changedTouches |
##Array |
Touch event, array of currently changed touch point information |
The above is the detailed content of WeChat applet WXML template syntax summary. 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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

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.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Atom editor mac version download
The most popular open source editor

Dreamweaver CS6
Visual web development tools

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.
