search
HomeWeChat AppletWeChat DevelopmentWeChat mini program page development

WeChat mini program page development

Jul 02, 2020 am 09:46 AM
WeChat applet

WXML (WeiXin Markup Language) is a set of tag languages ​​designed by the framework. Combined with basic components and event systems, it can build the structure of the page.

I think WXML is introduced through three dimensions: vertical, horizontal, and logical processing. Here is a brief introduction. They are also the basis for developing small programs. You can use them according to the document when needed. The details will be introduced later. The function will be expanded when time comes.

Vertical

Vertical: That is, the combination of components, including: system components, third-party components, custom components.

For example:

<view>
  <view>
      <image></image>
      <text> 用户名 </text>
  </view>
</view>

System components:

  • View container: cover-image, cover-view, movable-area, movable-view, scroll-view, swiper, swiper-item, view

  • Basic content: icon, progress, rich-text, text

  • Form components: button, checkbox, checkbox-group, editor, form , input, label, picker, picker-view, picker-view-column, radio, radio-group, slider, switch, textarea

  • Navigation: functional-page-navigator, navigator

  • Media components: audio, camera, image, live-player, live-pusher, video

  • Map: map

  • Canvas: canvas

  • ##Open capabilities: ad, official-account, open-data, web-view

  • Native Component description: native-component

  • Accessibility: aria-component

  • Navigation bar: navigation-bar

  • Page attribute configuration node: page-meta

Specific reference:


https://developers.weixin.qq.com/miniprogram/dev /component/native-component.html

##Third-party components

: For example, WeUI component library, etc.

Custom components

: Custom The component has its own wxml template and wxss styleHorizontal

Horizontal: component attributes

##Attribute name DescriptionidUnique identificationclassStyle SheetstyleInline stylehiddenhiddendata-*Event delivery databind* /catch*Component eventLogical processing
Logical processing: Determine how to display the view based on the bound data

Data binding

<!--wxml-->
<view> {{message}} </view>
// page.js
Page({
  data: {
    message: 'Hello MINA!'
  }
})
List rendering

<!--wxml-->
<view> {{item}} </view>
// page.js
Page({
  data: {
    array: [1, 2, 3, 4, 5]
  }
})
Conditional rendering

<!--wxml-->
<view> WEBVIEW </view>
<view> APP </view>
<view> MINA </view>
// page.js
Page({
  data: {
    view: 'MINA'
  }
})
The block used to wrap the view component

If wx: for, wx:if To render a view container, you can wrap it with a block tag. The block tag is not a component, but an element used for packaging. It will not be rendered and only accepts wx:.. control attributes.

block and wx:if:

<block>
  <view> view1 </view>
  <view> view2 </view>
</block>
block and wx:for:

<block>
  <view> {{index}}: </view>
  <view> {{item}} </view>
</block>
Recommended tutorial: "

WeChat Mini Program

"

The above is the detailed content of WeChat mini program page development. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:简书. If there is any infringement, please contact admin@php.cn delete

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)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development 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