WeChat mini-app reference tutorial

Source: Internet
Author: User
This article mainly introduces the references of small programs and the simple instance code. For more information, see this article, and a simple instance code. For more information, see

Series of articles:

Mini-program tutorial-WXSS
References to mini-program tutorials
Events of mini-program tutorials
Small program tutorial template
List rendering of Applet tutorials
Conditional rendering of mini-program tutorials
Data binding in applet tutorial
Mini-program tutorial-WXML

Reference

WXML provides two file reference methods: import and include.

Import

Import can use the template defined in the target file in this file, for example:

A template named item is defined in item. wxml:


 
  
  
   {{text}}
  
 

You can use the item template by referencing item. wxml in index. wxml:


 
 

Scope of import

Import has the concept of scope, that is, only the template defined in the target file will be imported, rather than the template of the target file import.
For example, C import B, B import A. in C, you can use the template defined by B. in B, you can use the template defined by A, but C cannot use the template defined by.


 
  
  
    A template 
  
 


 
 
  
  
    B template 
  
 


 
 
  
 
 

Include

Include can export the target file The entire code is introduced, which is equivalent to copying to the include position, such:


 
 
 
   body 
 
 


 
 
   header 
 


 
 
   footer 
 

Thank you for reading this article. I hope it will help you. thank you for your support for this site!

The above is the detailed content of the reference tutorial for small programs. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.